本文整理汇总了Python中setuptools.command.develop.develop方法的典型用法代码示例。如果您正苦于以下问题:Python develop.develop方法的具体用法?Python develop.develop怎么用?Python develop.develop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类setuptools.command.develop
的用法示例。
在下文中一共展示了develop.develop方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_cmdclass
# 需要导入模块: from setuptools.command import develop [as 别名]
# 或者: from setuptools.command.develop import develop [as 别名]
def create_cmdclass(wrappers=None, data_dirs=None):
"""Create a command class with the given optional wrappers.
Parameters
----------
wrappers: list(str), optional
The cmdclass names to run before running other commands
data_dirs: list(str), optional.
The directories containing static data.
"""
egg = bdist_egg if 'bdist_egg' in sys.argv else bdist_egg_disabled
wrappers = wrappers or []
data_dirs = data_dirs or []
wrapper = functools.partial(wrap_command, wrappers, data_dirs)
cmdclass = dict(
build_py=wrapper(build_py, strict=is_repo),
sdist=wrapper(sdist, strict=True),
bdist_egg=egg,
develop=wrapper(develop, strict=True)
)
if bdist_wheel:
cmdclass['bdist_wheel'] = wrapper(bdist_wheel, strict=True)
return cmdclass
示例2: make_extraversion
# 需要导入模块: from setuptools.command import develop [as 别名]
# 或者: from setuptools.command.develop import develop [as 别名]
def make_extraversion(editable=False):
"""Compile extra version information for use at runtime.
Additional information will include:
- values of DIST_NAME and DIST_PACKAGE environment variables
- whether the installation is running in develop/editable mode
- git HEAD commit hash and whether the tree is dirty
"""
extra = {}
extra['dist_name'] = os.getenv('DIST_NAME')
extra['dist_package'] = os.getenv('DIST_PACKAGE')
extra['editable'] = editable
if get_git_version() and os.path.isdir('.git'):
rev_parse = subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip().decode()
describe = subprocess.check_output(['git', 'describe', '--always', '--dirty']).strip().decode()
extra['commit'] = rev_parse
extra['dirty'] = describe.endswith('-dirty')
with open('liquidctl/extraversion.py', 'w') as fv:
fv.write('__extraversion__ = {!r}'.format(extra))
示例3: install_wrapper_scripts
# 需要导入模块: from setuptools.command import develop [as 别名]
# 或者: from setuptools.command.develop import develop [as 别名]
def install_wrapper_scripts(self, dist):
develop.develop.install_wrapper_scripts(self, dist)
if self.exclude_scripts:
return
script = easy_install.get_script_header("") + SCRIPT_TMPL
if PY3:
script = script.encode('ascii')
self.write_script("gnocchi-api", script, 'b')
示例4: setup
# 需要导入模块: from setuptools.command import develop [as 别名]
# 或者: from setuptools.command.develop import develop [as 别名]
def setup(**kwargs):
cmdclass = kwargs.setdefault("cmdclass", {})
cmdclass["develop"] = type(
"develop_with_pth_hook",
(pth_hook_mixin, cmdclass.get("develop", develop)),
{})
cmdclass["install_lib"] = type(
"install_lib_with_pth_hook",
(pth_hook_mixin, cmdclass.get("install_lib", install_lib)),
{})
setuptools.setup(**kwargs)
示例5: install_wrapper_scripts
# 需要导入模块: from setuptools.command import develop [as 别名]
# 或者: from setuptools.command.develop import develop [as 别名]
def install_wrapper_scripts(self, dist):
if sys.platform == 'win32':
return develop.develop.install_wrapper_scripts(self, dist)
if not self.exclude_scripts:
for args in override_get_script_args(dist):
self.write_script(*args)
示例6: install_geonotebook_ini
# 需要导入模块: from setuptools.command import develop [as 别名]
# 或者: from setuptools.command.develop import develop [as 别名]
def install_geonotebook_ini(cmd, link=False):
# cmd.dist is a pkg_resources.Distribution class, See:
# http://setuptools.readthedocs.io/en/latest/pkg_resources.html#distribution-objects
# pkg_resources.Distribution.location can be a lot of things, but in the
# case of a develop install it will be the path to the source tree. This
# will not work if applied to more exotic install targets
# (e.g. pip install -e git@github.com:OpenGeoscience/geonotebook.git)
base_dir = cmd.dist.location
# cmd.distribution is a setuptools.dist.Distribution class, See:
# https://github.com/pypa/setuptools/blob/master/setuptools/dist.py#L215
for sys_path, local_paths in cmd.distribution.data_files:
try:
os.makedirs(os.path.join(sys.prefix, sys_path))
except OSError:
pass
for local_path in local_paths:
for l in glob.glob(local_path):
src = os.path.join(base_dir, l)
dest = os.path.join(sys_path, os.path.basename(src))\
if sys_path.startswith("/") else \
os.path.join(sys.prefix, sys_path, os.path.basename(src))
if os.path.lexists(dest):
os.remove(dest)
if link:
log.info("linking {} to {}".format(src, dest))
os.symlink(src, dest)
else:
log.info("copying {} to {}".format(src, dest))
shutil.copyfile(src, dest)
示例7: _get_develop_handler
# 需要导入模块: from setuptools.command import develop [as 别名]
# 或者: from setuptools.command.develop import develop [as 别名]
def _get_develop_handler():
"""Get a handler for the develop command"""
class _develop(develop):
def install_for_development(self):
super(_develop, self).install_for_development()
self.run_command('handle_files')
for _, filenames in self.distribution.data_files:
for filename in filenames:
target = os.path.join(sys.prefix, filename)
self.mkpath(os.path.dirname(target))
outf, copied = self.copy_file(filename, target)
return _develop
示例8: create_cmdclass
# 需要导入模块: from setuptools.command import develop [as 别名]
# 或者: from setuptools.command.develop import develop [as 别名]
def create_cmdclass(prerelease_cmd=None, package_data_spec=None,
data_files_spec=None):
"""Create a command class with the given optional prerelease class.
Parameters
----------
prerelease_cmd: (name, Command) tuple, optional
The command to run before releasing.
package_data_spec: dict, optional
A dictionary whose keys are the dotted package names and
whose values are a list of glob patterns.
data_files_spec: list, optional
A list of (path, dname, pattern) tuples where the path is the
`data_files` install path, dname is the source directory, and the
pattern is a glob pattern.
Notes
-----
We use specs so that we can find the files *after* the build
command has run.
The package data glob patterns should be relative paths from the package
folder containing the __init__.py file, which is given as the package
name.
e.g. `dict(foo=['./bar/*', './baz/**'])`
The data files directories should be absolute paths or relative paths
from the root directory of the repository. Data files are specified
differently from `package_data` because we need a separate path entry
for each nested folder in `data_files`, and this makes it easier to
parse.
e.g. `('share/foo/bar', 'pkgname/bizz, '*')`
"""
wrapped = [prerelease_cmd] if prerelease_cmd else []
if package_data_spec or data_files_spec:
wrapped.append('handle_files')
wrapper = functools.partial(_wrap_command, wrapped)
handle_files = _get_file_handler(package_data_spec, data_files_spec)
if 'bdist_egg' in sys.argv:
egg = wrapper(bdist_egg, strict=True)
else:
egg = bdist_egg_disabled
cmdclass = dict(
build_py=wrapper(build_py, strict=is_repo),
bdist_egg=egg,
sdist=wrapper(sdist, strict=True),
handle_files=handle_files,
)
if bdist_wheel:
cmdclass['bdist_wheel'] = wrapper(bdist_wheel, strict=True)
cmdclass['develop'] = wrapper(develop, strict=True)
return cmdclass
示例9: test_develop
# 需要导入模块: from setuptools.command import develop [as 别名]
# 或者: from setuptools.command.develop import develop [as 别名]
def test_develop(self):
if sys.version < "2.6" or hasattr(sys, 'real_prefix'):
return
dist = Distribution(
dict(name='foo',
packages=['foo'],
use_2to3=True,
version='0.0',
))
dist.script_name = 'setup.py'
cmd = develop(dist)
cmd.user = 1
cmd.ensure_finalized()
cmd.install_dir = site.USER_SITE
cmd.user = 1
old_stdout = sys.stdout
#sys.stdout = StringIO()
try:
cmd.run()
finally:
sys.stdout = old_stdout
# let's see if we got our egg link at the right place
content = os.listdir(site.USER_SITE)
content.sort()
self.assertEqual(content, ['easy-install.pth', 'foo.egg-link'])
# Check that we are using the right code.
egg_link_file = open(os.path.join(site.USER_SITE, 'foo.egg-link'), 'rt')
try:
path = egg_link_file.read().split()[0].strip()
finally:
egg_link_file.close()
init_file = open(os.path.join(path, 'foo', '__init__.py'), 'rt')
try:
init = init_file.read().strip()
finally:
init_file.close()
if sys.version < "3":
self.assertEqual(init, 'print "foo"')
else:
self.assertEqual(init, 'print("foo")')
示例10: create_cmdclass
# 需要导入模块: from setuptools.command import develop [as 别名]
# 或者: from setuptools.command.develop import develop [as 别名]
def create_cmdclass(prerelease_cmd=None, package_data_spec=None, data_files_spec=None):
"""Create a command class with the given optional prerelease class.
Parameters
----------
prerelease_cmd: (name, Command) tuple, optional
The command to run before releasing.
package_data_spec: dict, optional
A dictionary whose keys are the dotted package names and
whose values are a list of glob patterns.
data_files_spec: list, optional
A list of (path, dname, pattern) tuples where the path is the
`data_files` install path, dname is the source directory, and the
pattern is a glob pattern.
Notes
-----
We use specs so that we can find the files *after* the build
command has run.
The package data glob patterns should be relative paths from the package
folder containing the __init__.py file, which is given as the package
name.
e.g. `dict(foo=['./bar/*', './baz/**'])`
The data files directories should be absolute paths or relative paths
from the root directory of the repository. Data files are specified
differently from `package_data` because we need a separate path entry
for each nested folder in `data_files`, and this makes it easier to
parse.
e.g. `('share/foo/bar', 'pkgname/bizz, '*')`
"""
wrapped = [prerelease_cmd] if prerelease_cmd else []
if package_data_spec or data_files_spec:
wrapped.append("handle_files")
wrapper = functools.partial(_wrap_command, wrapped)
handle_files = _get_file_handler(package_data_spec, data_files_spec)
if "bdist_egg" in sys.argv:
egg = wrapper(bdist_egg, strict=True)
else:
egg = bdist_egg_disabled
cmdclass = dict(
build_py=wrapper(build_py, strict=is_repo),
bdist_egg=egg,
sdist=wrapper(sdist, strict=True),
handle_files=handle_files,
)
if bdist_wheel:
cmdclass["bdist_wheel"] = wrapper(bdist_wheel, strict=True)
cmdclass["develop"] = wrapper(develop, strict=True)
return cmdclass
示例11: create_cmdclass
# 需要导入模块: from setuptools.command import develop [as 别名]
# 或者: from setuptools.command.develop import develop [as 别名]
def create_cmdclass(prerelease_cmd=None, package_data_spec=None,
data_files_spec=None):
"""Create a command class with the given optional prerelease class.
Parameters
----------
prerelease_cmd: (name, Command) tuple, optional
The command to run before releasing.
package_data_spec: dict, optional
A dictionary whose keys are the dotted package names and
whose values are a list of glob patterns.
data_files_spec: list, optional
A list of (path, dname, pattern) tuples where the path is the
`data_files` install path, dname is the source directory, and the
pattern is a glob pattern.
Notes
-----
We use specs so that we can find the files *after* the build
command has run.
The package data glob patterns should be relative paths from the package
folder containing the __init__.py file, which is given as the package
name.
e.g. `dict(foo=['./bar/*', './baz/**'])`
The data files directories should be absolute paths or relative paths
from the root directory of the repository. Data files are specified
differently from `package_data` because we need a separate path entry
for each nested folder in `data_files`, and this makes it easier to
parse.
e.g. `('share/foo/bar', 'pkgname/bizz, '*')`
"""
wrapped = [prerelease_cmd] if prerelease_cmd else []
if package_data_spec or data_files_spec:
wrapped.append('handle_files')
wrapper = functools.partial(_wrap_command, wrapped)
handle_files = _get_file_handler(package_data_spec, data_files_spec)
develop_handler = _get_develop_handler()
if 'bdist_egg' in sys.argv:
egg = wrapper(bdist_egg, strict=True)
else:
egg = bdist_egg_disabled
is_repo = os.path.exists('.git')
cmdclass = dict(
build_py=wrapper(build_py, strict=is_repo),
bdist_egg=egg,
sdist=wrapper(sdist, strict=True),
handle_files=handle_files,
)
if bdist_wheel:
cmdclass['bdist_wheel'] = wrapper(bdist_wheel, strict=True)
cmdclass['develop'] = wrapper(develop_handler, strict=True)
return cmdclass