Python setuptools.command.develop.develop() Examples
The following are 20
code examples of setuptools.command.develop.develop().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
setuptools.command.develop
, or try the search function
.
Example #1
Source File: setup.py From liquidctl with GNU General Public License v3.0 | 6 votes |
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))
Example #2
Source File: setupbase.py From K3D-jupyter with MIT License | 6 votes |
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
Example #3
Source File: setuptools.py From gnocchi with Apache License 2.0 | 5 votes |
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')
Example #4
Source File: setupbase.py From jupyter-packaging with BSD 3-Clause "New" or "Revised" License | 5 votes |
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
Example #5
Source File: packaging.py From keras-lambda with MIT License | 5 votes |
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)
Example #6
Source File: setup.py From geonotebook with Apache License 2.0 | 5 votes |
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)
Example #7
Source File: packaging.py From auto-alt-text-lambda-api with MIT License | 5 votes |
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)
Example #8
Source File: setupext.py From mplcursors with MIT License | 5 votes |
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)
Example #9
Source File: setupbase.py From ipyevents with BSD 3-Clause "New" or "Revised" License | 4 votes |
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
Example #10
Source File: test_develop.py From oss-ftp with MIT License | 4 votes |
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")')
Example #11
Source File: setupbase.py From jupyterlab-latex with BSD 3-Clause "New" or "Revised" License | 4 votes |
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
Example #12
Source File: setupbase.py From jupyterlab-s3-browser with Apache License 2.0 | 4 votes |
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
Example #13
Source File: setupbase.py From widget-ts-cookiecutter with BSD 3-Clause "New" or "Revised" License | 4 votes |
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
Example #14
Source File: setupbase.py From ipycanvas with BSD 3-Clause "New" or "Revised" License | 4 votes |
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
Example #15
Source File: test_develop.py From pledgeservice with Apache License 2.0 | 4 votes |
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")')
Example #16
Source File: setupbase.py From dask-labextension with BSD 3-Clause "New" or "Revised" License | 4 votes |
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
Example #17
Source File: test_develop.py From Flask with Apache License 2.0 | 4 votes |
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")')
Example #18
Source File: test_develop.py From Flask with Apache License 2.0 | 4 votes |
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")')
Example #19
Source File: setupbase.py From jupyter-packaging with BSD 3-Clause "New" or "Revised" License | 4 votes |
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
Example #20
Source File: setupbase.py From jupyterlab-sidecar with BSD 3-Clause "New" or "Revised" License | 4 votes |
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