mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
fixing python setup.py clean
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@ -14,6 +14,11 @@ torch/csrc/nn/THNN.cwrap
|
||||
torch/csrc/nn/THNN.cpp
|
||||
torch/csrc/nn/THCUNN.cwrap
|
||||
torch/csrc/nn/THCUNN.cpp
|
||||
*/*.pyc
|
||||
*/**/*.pyc
|
||||
*/**/**/*.pyc
|
||||
*/**/**/**/*.pyc
|
||||
*/**/**/**/**/*.pyc
|
||||
*/*.so*
|
||||
*/**/*.so*
|
||||
*/**/*.dylib*
|
||||
|
10
setup.py
10
setup.py
@ -104,10 +104,16 @@ class install(setuptools.command.install.install):
|
||||
|
||||
class clean(distutils.command.clean.clean):
|
||||
def run(self):
|
||||
import glob
|
||||
with open('.gitignore', 'r') as f:
|
||||
ignores = f.read()
|
||||
for glob in filter(bool, ignores.split('\n')):
|
||||
shutil.rmtree(glob, ignore_errors=True)
|
||||
for wildcard in filter(bool, ignores.split('\n')):
|
||||
for filename in glob.glob(wildcard):
|
||||
try:
|
||||
os.remove(filename)
|
||||
except OSError:
|
||||
shutil.rmtree(filename, ignore_errors=True)
|
||||
|
||||
# It's an old-style class in Python 2.7...
|
||||
distutils.command.clean.clean.run(self)
|
||||
|
||||
|
Reference in New Issue
Block a user