diff options
author | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-01-12 11:02:04 +0200 |
---|---|---|
committer | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-01-12 11:02:04 +0200 |
commit | 995e61bf79b55b69fc9303b4b93d59ec3cd31a9c (patch) | |
tree | 2f60c3cbd2a93b5cc2c30fb5d831041ff5ebd853 | |
parent | eaf6aeb50f5bee0364bbac8aef557083dd34e37d (diff) | |
download | pylint-995e61bf79b55b69fc9303b4b93d59ec3cd31a9c.tar.gz |
Don't compile test files when installing.
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | setup.py | 28 |
2 files changed, 25 insertions, 4 deletions
@@ -37,6 +37,7 @@ ChangeLog for Pylint * Add the method names for the 'signature-differs' and 'argument-differs' warnings. Closes issue #433. + * Don't compile test files when installing. 2014-11-23 -- 1.4.0 @@ -32,12 +32,14 @@ try: if os.environ.get('NO_SETUPTOOLS'): raise ImportError() from setuptools import setup + from setuptools.command import easy_install as easy_install_lib from setuptools.command import install_lib USE_SETUPTOOLS = 1 except ImportError: from distutils.core import setup from distutils.command import install_lib USE_SETUPTOOLS = 0 + easy_install_lib = None from distutils.command.build_py import build_py @@ -97,6 +99,11 @@ except ImportError: pass ''' +def _filter_tests(files): + testdir = join('pylint', 'test') + return [f for f in files if testdir not in f] + + class MyInstallLib(install_lib.install_lib): """extend install_lib command to handle package __init__.py and include_dirs variable if necessary @@ -138,10 +145,20 @@ class MyInstallLib(install_lib.install_lib): # files, some of them being syntactically wrong by design, and this scares # the end-user def byte_compile(self, files): - testdir = join('pylint', 'test') - files = [f for f in files if testdir not in f] + files = _filter_tests(files) install_lib.install_lib.byte_compile(self, files) + +if easy_install_lib: + class easy_install(easy_install_lib.easy_install): + # override this since pip/easy_install attempt to byte compile + # test data files, some of them being syntactically wrong by design, + # and this scares the end-user + def byte_compile(self, files): + files = _filter_tests(files) + easy_install_lib.easy_install.byte_compile(self, files) + + def install(**kwargs): """setup entry point""" if USE_SETUPTOOLS: @@ -171,6 +188,10 @@ def install(**kwargs): 'symilar = pylint:run_symilar', ]} kwargs['packages'] = packages + cmdclass = {'install_lib': MyInstallLib, + 'build_py': build_py} + if easy_install: + cmdclass['easy_install'] = easy_install return setup(name=distname, version=version, license=license, @@ -183,8 +204,7 @@ def install(**kwargs): classifiers=classifiers, data_files=data_files, ext_modules=ext_modules, - cmdclass={'install_lib': MyInstallLib, - 'build_py': build_py}, + cmdclass=cmdclass, **kwargs) if __name__ == '__main__': |