本文整理汇总了Python中distutils.command.build_scripts.build_scripts方法的典型用法代码示例。如果您正苦于以下问题:Python build_scripts.build_scripts方法的具体用法?Python build_scripts.build_scripts怎么用?Python build_scripts.build_scripts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类distutils.command.build_scripts
的用法示例。
在下文中一共展示了build_scripts.build_scripts方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_build_scripts_cmd
# 需要导入模块: from distutils.command import build_scripts [as 别名]
# 或者: from distutils.command.build_scripts import build_scripts [as 别名]
def get_build_scripts_cmd(self, target, scripts):
import sys
dist = Distribution()
dist.scripts = scripts
dist.command_obj["build"] = support.DummyCommand(
build_scripts=target,
force=1,
executable=sys.executable
)
return build_scripts(dist)
示例2: run
# 需要导入模块: from distutils.command import build_scripts [as 别名]
# 或者: from distutils.command.build_scripts import build_scripts [as 别名]
def run(self):
build_scripts.build_scripts.run(self)
if not os.name == "nt":
return
for f in os.listdir(self.build_dir):
fpath=os.path.join(self.build_dir, f)
if not fpath.endswith(".py"):
try:
os.unlink(fpath + ".py")
except EnvironmentError, e:
if e.args[1]=='No such file or directory':
pass
os.rename(fpath, fpath + ".py")
示例3: get_setup_args
# 需要导入模块: from distutils.command import build_scripts [as 别名]
# 或者: from distutils.command.build_scripts import build_scripts [as 别名]
def get_setup_args(**kw):
if 'twisted_subproject' in kw:
if 'twisted' not in os.listdir('.'):
raise RuntimeError("Sorry, you need to run setup.py from the "
"toplevel source directory.")
projname = kw['twisted_subproject']
projdir = os.path.join('twisted', projname)
kw['packages'] = getPackages(projdir, parent='twisted')
kw['version'] = getVersion(projname)
plugin = "twisted/plugins/twisted_" + projname + ".py"
if os.path.exists(plugin):
kw.setdefault('py_modules', []).append(
plugin.replace("/", ".")[:-3])
kw['data_files'] = getDataFiles(projdir, parent='twisted')
del kw['twisted_subproject']
else:
if 'plugins' in kw:
py_modules = []
for plg in kw['plugins']:
py_modules.append("twisted.plugins." + plg)
kw.setdefault('py_modules', []).extend(py_modules)
del kw['plugins']
if 'cmdclass' not in kw:
kw['cmdclass'] = {
'install_data': install_data_twisted,
'build_scripts': build_scripts_twisted}
if sys.version_info[:3] < (2, 3, 0):
kw['cmdclass']['build_py'] = build_py_twisted
if "conditionalExtensions" in kw:
extensions = kw["conditionalExtensions"]
del kw["conditionalExtensions"]
if 'ext_modules' not in kw:
# This is a workaround for distutils behavior; ext_modules isn't
# actually used by our custom builder. distutils deep-down checks
# to see if there are any ext_modules defined before invoking
# the build_ext command. We need to trigger build_ext regardless
# because it is the thing that does the conditional checks to see
# if it should build any extensions. The reason we have to delay
# the conditional checks until then is that the compiler objects
# are not yet set up when this code is executed.
kw["ext_modules"] = extensions
class my_build_ext(build_ext_twisted):
conditionalExtensions = extensions
kw.setdefault('cmdclass', {})['build_ext'] = my_build_ext
return kw
示例4: setup
# 需要导入模块: from distutils.command import build_scripts [as 别名]
# 或者: from distutils.command.build_scripts import build_scripts [as 别名]
def setup(**kw):
"""
An alternative to distutils' setup() which is specially designed
for Twisted subprojects.
Pass twisted_subproject=projname if you want package and data
files to automatically be found for you.
Pass detectExtensions=detectorFunction if your project has
extension modules. detectorFunction will be called with an
instance of build_ext_twisted and should return a list of
distutils Extensions.
"""
if 'twisted_subproject' in kw:
if 'twisted' not in os.listdir('.'):
raise RuntimeError("Sorry, you need to run setup.py from the "
"toplevel source directory.")
projname = kw['twisted_subproject']
projdir = os.path.join('twisted', projname)
kw['packages'] = getPackages(projdir, parent='twisted')
kw['version'] = getVersion(projname)
plugin = "twisted/plugins/twisted_" + projname + ".py"
if os.path.exists(plugin):
kw.setdefault('py_modules', []).append(plugin.replace("/", ".")[:-3])
kw['data_files'] = getDataFiles(projdir, parent='twisted')
del kw['twisted_subproject']
else:
if 'plugins' in kw:
py_modules = []
for plg in kw['plugins']:
py_modules.append("twisted.plugins." + plg)
kw.setdefault('py_modules', []).extend(py_modules)
del kw['plugins']
if 'cmdclass' not in kw:
kw['cmdclass'] = {
'install_data': install_data_twisted,
'build_scripts': build_scripts_twisted}
if sys.version_info[:3] < (2, 3, 0):
kw['cmdclass']['build_py'] = build_py_twisted
if 'detectExtensions' in kw:
if 'ext_modules' not in kw:
kw['ext_modules'] = [True] # distutils is so lame
dE = kw['detectExtensions']
del kw['detectExtensions']
class my_build_ext(build_ext_twisted):
detectExtensions = dE
kw.setdefault('cmdclass', {})['build_ext'] = my_build_ext
return core.setup(**kw)