本文整理汇总了Python中setuptools.command.sdist.sdist.make_release_tree方法的典型用法代码示例。如果您正苦于以下问题:Python sdist.make_release_tree方法的具体用法?Python sdist.make_release_tree怎么用?Python sdist.make_release_tree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类setuptools.command.sdist.sdist
的用法示例。
在下文中一共展示了sdist.make_release_tree方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_release_tree
# 需要导入模块: from setuptools.command.sdist import sdist [as 别名]
# 或者: from setuptools.command.sdist.sdist import make_release_tree [as 别名]
def make_release_tree(self, base_dir, files):
import os
sdist.make_release_tree(self, base_dir, files)
version_file = os.path.join(base_dir, 'VERSION')
print('updating %s' % (version_file,))
# Write to temporary file first and rename over permanent not
# just to avoid atomicity issues (not likely an issue since if
# interrupted the whole sdist directory is only partially
# written) but because the upstream sdist may have made a hard
# link, so overwriting in place will edit the source tree.
with open(version_file + '.tmp', 'wb') as f:
f.write('%s\n' % (pkg_version,))
os.rename(version_file + '.tmp', version_file)
# XXX These should be attributes of `setup', but helpful distutils
# doesn't pass them through when it doesn't know about them a priori.
示例2: get_cmdclass
# 需要导入模块: from setuptools.command.sdist import sdist [as 别名]
# 或者: from setuptools.command.sdist.sdist import make_release_tree [as 别名]
def get_cmdclass(build_py=None, sdist=None):
"""Create cmdclass dict to pass to setuptools.setup that will write a
_version_static.py file in our resultant sdist, wheel or egg"""
if build_py is None:
from setuptools.command.build_py import build_py
if sdist is None:
from setuptools.command.sdist import sdist
def make_version_static(base_dir, pkg):
vg = os.path.join(base_dir, pkg.split(".")[0], "_version_git.py")
if os.path.isfile(vg):
lines = open(vg).readlines()
with open(vg, "w") as f:
for line in lines:
# Replace GIT_* with static versions
if line.startswith("GIT_SHA1 = "):
f.write("GIT_SHA1 = '%s'\n" % git_sha1)
elif line.startswith("GIT_REFS = "):
f.write("GIT_REFS = 'tag: %s'\n" % __version__)
else:
f.write(line)
class BuildPy(build_py):
def run(self):
build_py.run(self)
for pkg in self.packages:
make_version_static(self.build_lib, pkg)
class Sdist(sdist):
def make_release_tree(self, base_dir, files):
sdist.make_release_tree(self, base_dir, files)
for pkg in self.distribution.packages:
make_version_static(base_dir, pkg)
return dict(build_py=BuildPy, sdist=Sdist)
示例3: make_release_tree
# 需要导入模块: from setuptools.command.sdist import sdist [as 别名]
# 或者: from setuptools.command.sdist.sdist import make_release_tree [as 别名]
def make_release_tree(self, base_dir, files):
import os
sdist.make_release_tree(self, base_dir, files)
version_file = os.path.join(base_dir, 'VERSION')
print('updating %s' % (version_file,))
# Write to temporary file first and rename over permanent not
# just to avoid atomicity issues (not likely an issue since if
# interrupted the whole sdist directory is only partially
# written) but because the upstream sdist may have made a hard
# link, so overwriting in place will edit the source tree.
with open(version_file + '.tmp', 'wb') as f:
f.write('%s\n' % (pkg_version,))
os.rename(version_file + '.tmp', version_file)
示例4: make_release_tree
# 需要导入模块: from setuptools.command.sdist import sdist [as 别名]
# 或者: from setuptools.command.sdist.sdist import make_release_tree [as 别名]
def make_release_tree(self, basedir, files):
_sdist.make_release_tree(self, basedir, files)
self.execute(_run_build_tables, (basedir,),
msg="Build the lexing/parsing tables")
示例5: make_release_tree
# 需要导入模块: from setuptools.command.sdist import sdist [as 别名]
# 或者: from setuptools.command.sdist.sdist import make_release_tree [as 别名]
def make_release_tree(self, *a, **kw):
dist_path = self.distribution.get_fullname()
sdist.make_release_tree(self, *a, **kw)
self.reinitialize_command('build_static', work_path=dist_path)
self.run_command('build_static')
with open(os.path.join(dist_path, 'lemur-package.json'), 'w') as fp:
json.dump({
'createdAt': datetime.datetime.utcnow().isoformat() + 'Z',
}, fp)
示例6: make_release_tree
# 需要导入模块: from setuptools.command.sdist import sdist [as 别名]
# 或者: from setuptools.command.sdist.sdist import make_release_tree [as 别名]
def make_release_tree(self, base_dir, files):
if has_cython:
files = self.__filter_files(files)
_sdist.make_release_tree(self, base_dir, files)
minify_static_files(base_dir, files, self.static_exclude)
示例7: make_release_tree
# 需要导入模块: from setuptools.command.sdist import sdist [as 别名]
# 或者: from setuptools.command.sdist.sdist import make_release_tree [as 别名]
def make_release_tree(self, base_dir, files):
orig_sdist.make_release_tree(self, base_dir, files)
# add additional dependecies in the required version
for name, tar_src in self.contrib:
tarball = tar_src.format(versions[name + '_version'])
print("Downloading and adding {} sources from {}".format(name, tarball))
subprocess.call('wget -O - -q {} | tar xz -C {} --one-top-level=contrib/{} --strip-components=1'.format(
tarball, base_dir, name), shell=True)