From d147ac258b02dd929865ca85607763766b8dc714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= Date: Mon, 18 Mar 2013 21:44:28 +0100 Subject: Radical simplification ... MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- setup.py | 52 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 14 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index eb3626b..c12eb62 100644 --- a/setup.py +++ b/setup.py @@ -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, ) -- cgit v1.2.1