Permalink
Browse files

Merge branch 'activestate' into next

Conflicts:
	appdirs.py
  • Loading branch information...
eddyp committed Mar 19, 2013
2 parents dc43e8c + d83bba7 commit 3844b5dce0611198d67748f699249572a6766037
Showing with 92 additions and 836 deletions.
  1. +2 −0 .gitignore
  2. +9 −0 .travis.yml
  3. +1 −1 MANIFEST.in
  4. +5 −9 Makefile.py
  5. +0 −7 appdirs.komodoproject
  6. 0 {lib → }/appdirs.py
  7. +48 −15 setup.py
  8. 0 test/__init__.py
  9. +0 −28 test/api.doctests
  10. +0 −31 test/test.py
  11. +27 −0 test/test_api.py
  12. +0 −24 test/test_appdirs.py
  13. +0 −721 test/testlib.py
View
@@ -4,3 +4,5 @@ tmp/
build/
dist/
.tox/
+MANIFEST
+*.komodoproject
View
@@ -0,0 +1,9 @@
+language: python
+python:
+ - "2.5"
+ - "2.6"
+ - "2.7"
+ - "pypy"
+ - "3.2"
+ - "3.3"
+script: python setup.py test
View
@@ -1,4 +1,4 @@
include README.rst
include CHANGES.rst
include LICENSE.txt
-recursive-include lib *.py
+include *.py
View
@@ -1,6 +1,7 @@
+# This is a Makefile for the `mk` tool. Install it using,
+#
+# pip install which mk
-# This is a Makefile for the `mk` tool. (Limited) details for that here:
-# <http://svn.openkomodo.com/openkomodo/browse/mk>
import sys
import os
@@ -39,7 +40,7 @@ class cut_a_release(Task):
for details.
"""
proj_name = "appdirs"
- version_py_path = "lib/appdirs.py"
+ version_py_path = "appdirs.py"
version_module = "appdirs"
# XXX: this needs to be changed from .md to .rst format
@@ -163,8 +164,6 @@ def _get_next_version(self, version):
return version[:-len(str(last_bit))] + str(last_bit + 1)
def _get_version(self):
- lib_dir = join(dirname(abspath(__file__)), "lib")
- sys.path.insert(0, lib_dir)
try:
mod = __import__(self.version_module)
return mod.__version__
@@ -180,7 +179,6 @@ def make(self):
"build",
"MANIFEST",
"*.pyc",
- "lib/*.pyc",
]
for pattern in patterns:
p = join(self.dir, pattern)
@@ -201,7 +199,6 @@ def make(self):
% _setup_command_prefix(),
self.dir, self.log.debug)
- sys.path.insert(0, join(self.dir, "lib"))
url = "http://pypi.python.org/pypi/appdirs/"
import webbrowser
webbrowser.open_new(url)
@@ -224,8 +221,7 @@ def make(self):
ver_str = "%s.%s" % ver
print "-- test with Python %s (%s)" % (ver_str, python)
assert ' ' not in python
- sh.run_in_dir("%s test.py -- -knownfailure" % python,
- join(self.dir, "test"))
+ sh.run("%s setup.py test" % python)
def _python_ver_from_python(self, python):
assert ' ' not in python
View
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Komodo Project File - DO NOT EDIT -->
-<project id="2e6d94c8-bff8-c042-8d71-c7fd78beb274" kpf_version="5" name="appdirs.komodoproject">
-<preference-set idref="2e6d94c8-bff8-c042-8d71-c7fd78beb274">
- <boolean id="import_live">1</boolean>
-</preference-set>
-</project>
File renamed without changes.
View
@@ -1,24 +1,59 @@
#!/usr/bin/env python
-
import sys
import os
-from setuptools import setup, find_packages
+import os.path
+from distutils.core import setup, Command
+import appdirs
+requires_list = []
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
+else:
+ if sys.version_info <= (2, 6):
+ requires_list.append("unittest2")
-_top_dir = os.path.dirname(os.path.abspath(__file__))
-sys.path.insert(0, os.path.join(_top_dir, "lib"))
-try:
- import appdirs
-finally:
- del sys.path[0]
-README = open(os.path.join(_top_dir, 'README.rst')).read()
-CHANGES = open(os.path.join(_top_dir, 'CHANGES.rst')).read()
+class RunTests(Command):
+ """New setup.py command to run all tests for the package.
+ """
+ description = "run all tests for the package"
+
+ user_options = []
+
+ def initialize_options(self):
+ pass
+
+ def finalize_options(self):
+ pass
+
+ def run(self):
+ test_modules = ["test.%s" % filename.replace('.py', '')
+ for filename in os.listdir('test')
+ if filename.endswith('.py') and filename.startswith('test_')]
+ for mod in test_modules:
+ __import__(mod)
+
+ suite = unittest.TestSuite()
+ for mod in [sys.modules[modname] for modname in test_modules]:
+ suite.addTest(unittest.TestLoader().loadTestsFromModule(mod))
+ unittest.TextTestRunner(verbosity=2).run(suite)
+
+
+def read(fname):
+ inf = open(os.path.join(os.path.dirname(__file__), fname))
+ out = "\n" + inf.read().replace("\r\n", "\n")
+ inf.close()
+ return out
+
setup(name='appdirs',
version=appdirs.__version__,
- description='A small Python module for determining appropriate platform-specific dirs, e.g. a "user data dir".',
- long_description=README + '\n' + CHANGES,
+ description='A small Python module for determining appropriate " + \
+ "platform-specific dirs, e.g. a "user data dir".',
+ long_description=read('README.rst') + '\n' + read('CHANGES.rst'),
+ cmdclass={'test': RunTests},
classifiers=[c.strip() for c in """
Development Status :: 4 - Beta
Intended Audience :: Developers
@@ -34,6 +69,7 @@
Programming Language :: Python :: 3.2
Topic :: Software Development :: Libraries :: Python Modules
""".split('\n') if c.strip()],
+ requires=requires_list,
keywords='application directory log cache user',
author='Trent Mick',
author_email='trentm@gmail.com',
@@ -42,7 +78,4 @@
url='http://github.com/ActiveState/appdirs',
license='MIT',
py_modules=["appdirs"],
- package_dir={"": "lib"},
- include_package_data=True,
- zip_safe=False,
)
View
No changes.
View
@@ -1,28 +0,0 @@
-
->>> import appdirs
->>> hasattr(appdirs, "__version__")
-True
->>> hasattr(appdirs, "__version_info__")
-True
-
->>> type(appdirs.user_data_dir('MyApp', 'MyCompany')) == type('')
-True
->>> type(appdirs.site_data_dir('MyApp', 'MyCompany')) == type('')
-True
->>> type(appdirs.user_cache_dir('MyApp', 'MyCompany')) == type('')
-True
->>> type(appdirs.user_log_dir('MyApp', 'MyCompany')) == type('')
-True
-
-
->>> dirs = appdirs.AppDirs('MyApp', 'MyCompany', version='1.0')
->>> type(dirs.user_data_dir) == type('')
-True
->>> type(dirs.site_data_dir) == type('')
-True
->>> type(dirs.user_cache_dir) == type('')
-True
->>> type(dirs.user_log_dir) == type('')
-True
-
-
View
@@ -1,31 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2010 ActiveState Software Inc.
-# License: MIT (http://www.opensource.org/licenses/mit-license.php)
-
-"""The appdirs test suite entry point."""
-
-import os
-from os.path import exists, join, abspath, dirname, normpath
-import sys
-import logging
-
-import testlib
-
-log = logging.getLogger("test")
-testdir_from_ns = {
- None: os.curdir,
-}
-
-def setup():
- top_dir = dirname(dirname(abspath(__file__)))
- lib_dir = join(top_dir, "lib")
- sys.path.insert(0, lib_dir)
-
-if __name__ == "__main__":
- logging.basicConfig()
- setup()
- default_tags = []
- retval = testlib.harness(testdir_from_ns=testdir_from_ns,
- default_tags=default_tags)
- sys.exit(retval)
-
View
@@ -0,0 +1,27 @@
+import unittest
+import appdirs
+
+class Test_AppDir(unittest.TestCase):
+ def test_metadata(self):
+ self.assertTrue(hasattr(appdirs, "__version__"))
+ self.assertTrue(hasattr(appdirs, "__version_info__"))
+
+ def test_helpers(self):
+ self.assertTrue(isinstance(
+ appdirs.user_data_dir('MyApp', 'MyCompany'), str))
+ self.assertTrue(isinstance(
+ appdirs.site_data_dir('MyApp', 'MyCompany'), str))
+ self.assertTrue(isinstance(
+ appdirs.user_cache_dir('MyApp', 'MyCompany'), str))
+ self.assertTrue(isinstance(
+ appdirs.user_log_dir('MyApp', 'MyCompany'), str))
+
+ def test_dirs(self):
+ dirs = appdirs.AppDirs('MyApp', 'MyCompany', version='1.0')
+ self.assertTrue(isinstance(dirs.user_data_dir, str))
+ self.assertTrue(isinstance(dirs.site_data_dir, str))
+ self.assertTrue(isinstance(dirs.user_cache_dir, str))
+ self.assertTrue(isinstance(dirs.user_log_dir, str))
+
+if __name__=="__main__":
+ unittest.main()
View
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2010 ActiveState Software Inc.
-# License: MIT (http://www.opensource.org/licenses/mit-license.php)
-
-import os
-import sys
-from pprint import pprint
-import unittest
-import doctest
-
-from testlib import TestError, TestSkipped, tag
-
-
-class DocTestsTestCase(unittest.TestCase):
- def test_api(self):
- if sys.version_info[:2] < (2,4):
- raise TestSkipped("no DocFileTest in Python <=2.3")
- test = doctest.DocFileTest("api.doctests")
- test.runTest()
-
- def test_internal(self):
- import appdirs
- doctest.testmod(appdirs)
-
Oops, something went wrong.

0 comments on commit 3844b5d

Please sign in to comment.