* Fix clean function

This commit is contained in:
Matthew Honnibal 2015-03-09 01:46:35 -04:00
parent b3eda03c9c
commit 357dcdcc01

View File

@ -2,6 +2,7 @@
import subprocess import subprocess
from setuptools import setup from setuptools import setup
from glob import glob from glob import glob
import shutil
import sys import sys
import os import os
@ -49,15 +50,16 @@ except OSError:
pass pass
def clean(ext): def clean(mod_names):
for src in ext.sources: for name in mod_names:
if src.endswith('.c') or src.endswith('cpp'): name = name.replace('.', '/')
so = src.rsplit('.', 1)[0] + '.so' so = name + '.so'
html = src.rsplit('.', 1)[0] + '.html' html = name + '.html'
if os.path.exists(so): cpp = name + '.cpp'
os.unlink(so) c = name + '.c'
if os.path.exists(html): for file_path in [so, html, cpp, c]:
os.unlink(html) if os.path.exists(file_path):
shutil.move(file_path, '/tmp')
def name_to_path(mod_name, ext): def name_to_path(mod_name, ext):
@ -156,9 +158,13 @@ MOD_NAMES = ['spacy.parts_of_speech', 'spacy.strings',
'spacy.en.pos', 'spacy.syntax.parser', 'spacy.syntax._state', 'spacy.en.pos', 'spacy.syntax.parser', 'spacy.syntax._state',
'spacy.syntax.transition_system', 'spacy.syntax.transition_system',
'spacy.syntax.arc_eager', 'spacy.syntax._parse_features', 'spacy.syntax.arc_eager', 'spacy.syntax._parse_features',
'spacy.syntax.conll', 'spacy.orth'] 'spacy.syntax.conll', 'spacy.orth',
'spacy.syntax.ner']
if __name__ == '__main__': if __name__ == '__main__':
use_cython = sys.argv[1] == 'build_ext' if sys.argv[1] == 'clean':
main(MOD_NAMES, use_cython) clean(MOD_NAMES)
else:
use_cython = sys.argv[1] == 'build_ext'
main(MOD_NAMES, use_cython)