本文整理汇总了Python中distutils.command.clean.clean方法的典型用法代码示例。如果您正苦于以下问题:Python clean.clean方法的具体用法?Python clean.clean怎么用?Python clean.clean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类distutils.command.clean
的用法示例。
在下文中一共展示了clean.clean方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Clean
# 需要导入模块: from distutils.command import clean [as 别名]
# 或者: from distutils.command.clean import clean [as 别名]
def Clean(self):
assert self.extension_paths != None
self.SourceClean()
# You need to run both make clean and rm -rf as some modules relocate the shared libraries
clean_cmd = 'make clean ' + self.compiler_args
for _path in self.extension_paths:
if "LLDispatch" not in _path:
execute('cd '+_path+' && echo rm -rf *.'+self.extension_postfix+' && '+
clean_cmd+' && rm -rf *.'+self.extension_postfix)
elif "LLDispatch" in _path:
execute('cd '+_path+
' && echo rm -rf *.'+self.extension_postfix+' CythonSource/*.'+self.extension_postfix
+' && rm -rf *.'+self.extension_postfix+' CythonSource/*.'+
self.extension_postfix)
else:
execute('cd '+_path+' && echo rm -rf *.'+self.extension_postfix+' && rm -rf *.'+self.extension_postfix)
# # clean all crude and ext libs if any - this is dangerous if setup.py is ever invoked from outside the directory
# # which is certainly never the case
# execute("find . -name \*.so -delete")
# execute("find . -name \*.pyc -delete")
示例2: run
# 需要导入模块: from distutils.command import clean [as 别名]
# 或者: from distutils.command.clean import clean [as 别名]
def run(self):
self.run_command('build_ext')
self.do_egg_install()
#setuptools cleanup is weak, do it manually
cmdline = ''.join(sys.argv[1:])
if 'clean' in cmdline:
for tree in ['PyGBe.egg-info', 'build', 'dist']:
shutil.rmtree(tree, ignore_errors=True)
for swigfile in [
'pygbe/tree/calculateMultipoles.py',
'pygbe/tree/calculateMultipoles_wrap.cpp',
'pygbe/tree/direct.py',
'pygbe/tree/direct_wrap.cpp',
'pygbe/tree/multipole.py',
'pygbe/tree/multipole_wrap.cpp',
'pygbe/util/semi_analyticalwrap.py',
'pygbe/util/semi_analyticalwrap_wrap.cpp',]:
os.remove(swigfile)
示例3: test_simple_run
# 需要导入模块: from distutils.command import clean [as 别名]
# 或者: from distutils.command.clean import clean [as 别名]
def test_simple_run(self):
pkg_dir, dist = self.create_dist()
cmd = clean(dist)
# let's add some elements clean should remove
dirs = [(d, os.path.join(pkg_dir, d))
for d in ('build_temp', 'build_lib', 'bdist_base',
'build_scripts', 'build_base')]
for name, path in dirs:
os.mkdir(path)
setattr(cmd, name, path)
if name == 'build_base':
continue
for f in ('one', 'two', 'three'):
self.write_file(os.path.join(path, f))
# let's run the command
cmd.all = 1
cmd.ensure_finalized()
cmd.run()
# make sure the files where removed
for name, path in dirs:
self.assertFalse(os.path.exists(path),
'%s was not removed' % path)
# let's run the command again (should spit warnings but succeed)
cmd.all = 1
cmd.ensure_finalized()
cmd.run()
示例4: test_simple_run
# 需要导入模块: from distutils.command import clean [as 别名]
# 或者: from distutils.command.clean import clean [as 别名]
def test_simple_run(self):
pkg_dir, dist = self.create_dist()
cmd = clean(dist)
# let's add some elements clean should remove
dirs = [(d, os.path.join(pkg_dir, d))
for d in ('build_temp', 'build_lib', 'bdist_base',
'build_scripts', 'build_base')]
for name, path in dirs:
os.mkdir(path)
setattr(cmd, name, path)
if name == 'build_base':
continue
for f in ('one', 'two', 'three'):
self.write_file(os.path.join(path, f))
# let's run the command
cmd.all = 1
cmd.ensure_finalized()
cmd.run()
# make sure the files where removed
for name, path in dirs:
self.assertTrue(not os.path.exists(path),
'%s was not removed' % path)
# let's run the command again (should spit warnings but suceed)
cmd.all = 1
cmd.ensure_finalized()
cmd.run()
示例5: SourceClean
# 需要导入模块: from distutils.command import clean [as 别名]
# 或者: from distutils.command.clean import clean [as 别名]
def SourceClean(self):
assert self.extension_paths != None
source_clean_cmd = 'make source_clean ' + self.compiler_args
for _path in self.extension_paths:
if "_Assembly_" not in _path and "LLDispatch" not in _path:
execute('cd '+_path+' && '+source_clean_cmd)
elif "LLDispatch" in _path:
execute('cd '+_path+' && echo rm -rf *.cpp CythonSource/*.cpp && rm -rf *.cpp CythonSource/*.cpp')
elif "Assembly" in _path:
execute('cd '+_path+' && echo rm -rf *.cpp && rm -rf *.cpp')
execute('cd '+_path+' && python AOT_Assembler.py clean')
示例6: run
# 需要导入模块: from distutils.command import clean [as 别名]
# 或者: from distutils.command.clean import clean [as 别名]
def run(self):
"""Clean build, dist, pyc and egg from package and docs."""
super().run()
call('rm -vrf ./build ./dist ./*.pyc ./*.egg-info', shell=True)
call('find . -name __pycache__ -type d | xargs rm -rf', shell=True)
call('test -d docs && make -C docs/ clean', shell=True)
示例7: initialize_options
# 需要导入模块: from distutils.command import clean [as 别名]
# 或者: from distutils.command.clean import clean [as 别名]
def initialize_options(self):
distutils_clean.clean.initialize_options(self)
self.clean_directories = [
'{0}.egg-info'.format(self.distribution.get_name()), 'dist'
]
示例8: finalize_options
# 需要导入模块: from distutils.command import clean [as 别名]
# 或者: from distutils.command.clean import clean [as 别名]
def finalize_options(self):
distutils_clean.clean.finalize_options(self)
示例9: run
# 需要导入模块: from distutils.command import clean [as 别名]
# 或者: from distutils.command.clean import clean [as 别名]
def run(self):
for directory in self.clean_directories:
if os.path.exists(directory):
distutils.dir_util.remove_tree(directory, dry_run=self.dry_run)
# standard cleaning
distutils_clean.clean.run(self)
示例10: run
# 需要导入模块: from distutils.command import clean [as 别名]
# 或者: from distutils.command.clean import clean [as 别名]
def run(self):
install.run(self)
c = clean(self.distribution)
c.all = True
c.finalize_options()
c.run()
示例11: test_simple_run
# 需要导入模块: from distutils.command import clean [as 别名]
# 或者: from distutils.command.clean import clean [as 别名]
def test_simple_run(self):
pkg_dir, dist = self.create_dist()
cmd = clean(dist)
# let's add some elements clean should remove
dirs = [(d, os.path.join(pkg_dir, d))
for d in ('build_temp', 'build_lib', 'bdist_base',
'build_scripts', 'build_base')]
for name, path in dirs:
os.mkdir(path)
setattr(cmd, name, path)
if name == 'build_base':
continue
for f in ('one', 'two', 'three'):
self.write_file(os.path.join(path, f))
# let's run the command
cmd.all = 1
cmd.ensure_finalized()
cmd.run()
# make sure the files where removed
for name, path in dirs:
self.assertTrue(not os.path.exists(path),
'%s was not removed' % path)
# let's run the command again (should spit warnings but succeed)
cmd.all = 1
cmd.ensure_finalized()
cmd.run()
示例12: create_wotmod_file
# 需要导入模块: from distutils.command import clean [as 别名]
# 或者: from distutils.command.clean import clean [as 别名]
def create_wotmod_file(self):
self.distribution.run_command('clean')
self.distribution.run_command('bdist_wotmod')
bdist_wotmod = self.distribution.get_command_obj('bdist_wotmod')
# TODO: Copied from bdist_wotmod. Should instead add a method to the
# bdist_wotmod command class for asking the path programmatically.
wotmod_filename = "%s.%s_%s.wotmod" % (
bdist_wotmod.author_id, bdist_wotmod.mod_id, bdist_wotmod.mod_version)
return os.path.abspath(os.path.join(bdist_wotmod.dist_dir, wotmod_filename))