你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 04:56:51 +08:00
Improved the option to cleanup/remove Cython files, i.e. C files, and compiled (.so or .pyd) modules.
这个提交包含在:
38
setup.py
38
setup.py
@@ -64,26 +64,24 @@ for root, dirs, files in os.walk(os.path.join(os.getcwd(), 'user_libs')):
|
|||||||
if 'cleanall' in sys.argv:
|
if 'cleanall' in sys.argv:
|
||||||
USE_CYTHON = False
|
USE_CYTHON = False
|
||||||
print('Deleting Cython files...')
|
print('Deleting Cython files...')
|
||||||
for entry in os.scandir(os.path.join(os.getcwd(), packagename)):
|
for file in cythonfiles:
|
||||||
for file in cythonfiles:
|
filebase = os.path.splitext(file)[0]
|
||||||
tmp = os.path.splitext(file)
|
# Remove Cython C files
|
||||||
if entry.name.startswith(tmp[0]):
|
if os.path.isfile(filebase + '.c'):
|
||||||
# Remove Cython C files
|
try:
|
||||||
try:
|
os.remove(filebase + '.c')
|
||||||
os.remove(tmp[0] + '.c')
|
print('Removed: {}'.format(filebase + '.c'))
|
||||||
except OSError:
|
except OSError:
|
||||||
print('Could not remove: {}'.format(tmp[0] + '.c'))
|
print('Could not remove: {}'.format(filebase + '.c'))
|
||||||
# Remove compiled Cython modules
|
# Remove compiled Cython modules
|
||||||
libfilename = entry.name.split('.')[0]
|
libfile = glob.glob(os.path.join(os.getcwd(), os.path.splitext(file)[0]) + '*.pyd') + glob.glob(os.path.join(os.getcwd(), os.path.splitext(file)[0]) + '*.so')
|
||||||
if sys.platform == 'win32':
|
if libfile:
|
||||||
libfile = libfilename + '.pyd'
|
libfile = libfile[0]
|
||||||
else:
|
try:
|
||||||
libfile = libfilename + '.so'
|
os.remove(libfile)
|
||||||
|
print('Removed: {}'.format(os.path.join(packagename, os.path.split(libfile)[-1])))
|
||||||
try:
|
except OSError:
|
||||||
os.remove(libfile)
|
print('Could not remove: {}'.format(os.path.join(packagename, os.path.split(libfile)[-1])))
|
||||||
except OSError:
|
|
||||||
print('Could not remove: {}'.format(libfile))
|
|
||||||
# Remove build directory
|
# Remove build directory
|
||||||
shutil.rmtree(os.path.join(os.getcwd(), 'build'), ignore_errors=True)
|
shutil.rmtree(os.path.join(os.getcwd(), 'build'), ignore_errors=True)
|
||||||
# Now do a normal clean
|
# Now do a normal clean
|
||||||
|
在新工单中引用
屏蔽一个用户