diff options
author | Matěj Cepl <mcepl@redhat.com> | 2013-03-18 21:44:28 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2013-03-18 22:20:26 +0100 |
commit | d147ac258b02dd929865ca85607763766b8dc714 (patch) | |
tree | 27eb5783d859a9713aee7681f78bb083ef537322 /setup.py | |
parent | 43812022adc51ea269f7bfd68c1d66e9d307d367 (diff) | |
download | appdirs-d147ac258b02dd929865ca85607763766b8dc714.tar.gz |
Radical simplification ...
Don’t use third part modules when you don’t have to.
This library uses setup like for thousands line program (including own
test harness), but doesn't contain almost anything. I think radical
simplification would be helpful.
Fixes #15
Fixes #10
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 52 |
1 files changed, 38 insertions, 14 deletions
@@ -2,23 +2,49 @@ import sys import os -from setuptools import setup, find_packages +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): + tests = unittest.TestLoader().discover('.') + runner = unittest.TextTestRunner(verbosity=2) + runner.run(tests) + + +def read(fname): + with open(os.path.join(os.path.dirname(__file__), fname)) as inf: + return "\n" + inf.read().replace("\r\n", "\n") + 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 +60,7 @@ setup(name='appdirs', 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 +69,4 @@ setup(name='appdirs', url='http://github.com/ActiveState/appdirs', license='MIT', py_modules=["appdirs"], - package_dir={"": "lib"}, - include_package_data=True, - zip_safe=False, ) |