Skip to content

Commit

Permalink
Make clean command a bit more comprehensive
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldmccarthy committed Sep 5, 2017
1 parent e49eeb0 commit c36e7b8
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python

import os
import glob
import os.path as op
import shutil

Expand All @@ -19,24 +20,34 @@ def finalize_options( self): pass

def run(self):

shutil.rmtree('build', ignore_errors=True)
shutil.rmtree('dist', ignore_errors=True)
shutil.rmtree('indexed_gzip.egg-info', ignore_errors=True)
shutil.rmtree('.eggs', ignore_errors=True)
base = op.dirname(__file__)

shutil.rmtree(op.join(base, 'build'),
ignore_errors=True)
shutil.rmtree(op.join(base, 'dist'),
ignore_errors=True)
shutil.rmtree(op.join(base, 'indexed_gzip.egg-info'),
ignore_errors=True)
shutil.rmtree(op.join(base, '.eggs'),
ignore_errors=True)
shutil.rmtree(op.join(base, '__pycache__'),
ignore_errors=True)
shutil.rmtree(op.join(base, 'tests', '__pycache__'),
ignore_errors=True)

files = [
'indexed_gzip.c',
'setup.pyc',
'*.pyc',
'*.so',
op.join('tests', '*.so'),
op.join('tests', '*.pyc'),
op.join('tests', 'ctest_zran.c'),
op.join('tests', 'ctest_indexed_gzip.c'),
op.join('tests', '__init__.pyc'),
op.join('tests', 'conftest.pyc'),
op.join('tests', 'test_zran.pyc'),
op.join('tests', 'test_indexed_gzip.pyc')]
op.join('tests', 'ctest_indexed_gzip.c')]

for f in files:
try: os.remove(f)
except OSError: pass
for g in glob.glob(f):
try: os.remove(g)
except OSError: pass


# If cython is present, we'll compile
Expand Down

0 comments on commit c36e7b8

Please sign in to comment.