mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Extend setuptools
clean command to remove compiled python files.
This commit is contained in:
parent
d6d8e22b68
commit
3f6d79884f
1 changed files with 18 additions and 1 deletions
19
setup.py
19
setup.py
|
@ -9,6 +9,7 @@ from __future__ import with_statement
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from distutils.cmd import Command
|
from distutils.cmd import Command
|
||||||
|
from distutils.command.clean import clean
|
||||||
from distutils.sysconfig import get_python_lib, PREFIX
|
from distutils.sysconfig import get_python_lib, PREFIX
|
||||||
|
|
||||||
# Use setuptools only if the user opts-in by setting the USE_SETUPTOOLS env var
|
# Use setuptools only if the user opts-in by setting the USE_SETUPTOOLS env var
|
||||||
|
@ -64,6 +65,22 @@ class TestCommand(Command):
|
||||||
test_process.communicate()
|
test_process.communicate()
|
||||||
sys.exit(test_process.returncode)
|
sys.exit(test_process.returncode)
|
||||||
|
|
||||||
|
|
||||||
|
class Clean(clean):
|
||||||
|
def run(self):
|
||||||
|
clean.run(self)
|
||||||
|
# Let's clean compiled *.py[c,o]
|
||||||
|
remove_extensions = ('.pyc', '.pyo')
|
||||||
|
for subdir in ('salt', 'tests'):
|
||||||
|
root = os.path.join(os.path.dirname(__file__), subdir)
|
||||||
|
for dirname, dirnames, filenames in os.walk(root):
|
||||||
|
for filename in filenames:
|
||||||
|
for ext in remove_extensions:
|
||||||
|
if filename.endswith(ext):
|
||||||
|
os.remove(os.path.join(dirname, filename))
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
NAME = 'salt'
|
NAME = 'salt'
|
||||||
VER = __version__
|
VER = __version__
|
||||||
DESC = ('Portable, distributed, remote execution and '
|
DESC = ('Portable, distributed, remote execution and '
|
||||||
|
@ -91,7 +108,7 @@ setup_kwargs = {'name': NAME,
|
||||||
'author': 'Thomas S Hatch',
|
'author': 'Thomas S Hatch',
|
||||||
'author_email': 'thatch45@gmail.com',
|
'author_email': 'thatch45@gmail.com',
|
||||||
'url': 'http://saltstack.org',
|
'url': 'http://saltstack.org',
|
||||||
'cmdclass': {'test': TestCommand},
|
'cmdclass': {'test': TestCommand, 'clean': Clean},
|
||||||
'classifiers': ['Programming Language :: Python',
|
'classifiers': ['Programming Language :: Python',
|
||||||
'Programming Language :: Cython',
|
'Programming Language :: Cython',
|
||||||
'Programming Language :: Python :: 2.6',
|
'Programming Language :: Python :: 2.6',
|
||||||
|
|
Loading…
Add table
Reference in a new issue