summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorClaudiu Popa <cpopa@cloudbasesolutions.com>2015-01-12 11:02:04 +0200
committerClaudiu Popa <cpopa@cloudbasesolutions.com>2015-01-12 11:02:04 +0200
commit995e61bf79b55b69fc9303b4b93d59ec3cd31a9c (patch)
tree2f60c3cbd2a93b5cc2c30fb5d831041ff5ebd853 /setup.py
parenteaf6aeb50f5bee0364bbac8aef557083dd34e37d (diff)
downloadpylint-995e61bf79b55b69fc9303b4b93d59ec3cd31a9c.tar.gz
Don't compile test files when installing.
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py28
1 files changed, 24 insertions, 4 deletions
diff --git a/setup.py b/setup.py
index 9fc40d7..4ae7d2d 100644
--- a/setup.py
+++ b/setup.py
@@ -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__':