install zeroconf
This commit is contained in:
parent
0b9788acc3
commit
9d2628be78
108 changed files with 8626 additions and 840 deletions
|
|
@ -136,13 +136,15 @@ class easy_install(Command):
|
|||
('local-snapshots-ok', 'l',
|
||||
"allow building eggs from local checkouts"),
|
||||
('version', None, "print version information and exit"),
|
||||
('install-layout=', None, "installation layout to choose (known values: deb)"),
|
||||
('force-installation-into-system-dir', '0', "force installation into /usr"),
|
||||
('no-find-links', None,
|
||||
"Don't load find-links defined in packages being installed")
|
||||
]
|
||||
boolean_options = [
|
||||
'zip-ok', 'multi-version', 'exclude-scripts', 'upgrade', 'always-copy',
|
||||
'editable',
|
||||
'no-deps', 'local-snapshots-ok', 'version'
|
||||
'no-deps', 'local-snapshots-ok', 'version', 'force-installation-into-system-dir'
|
||||
]
|
||||
|
||||
if site.ENABLE_USER_SITE:
|
||||
|
|
@ -190,6 +192,11 @@ class easy_install(Command):
|
|||
self.site_dirs = None
|
||||
self.installed_projects = {}
|
||||
self.sitepy_installed = False
|
||||
# enable custom installation, known values: deb
|
||||
self.install_layout = None
|
||||
self.force_installation_into_system_dir = None
|
||||
self.multiarch = None
|
||||
|
||||
# Always read easy_install options, even if we are subclassed, or have
|
||||
# an independent instance created. This ensures that defaults will
|
||||
# always come from the standard configuration file(s)' "easy_install"
|
||||
|
|
@ -258,6 +265,13 @@ class easy_install(Command):
|
|||
self.expand_basedirs()
|
||||
self.expand_dirs()
|
||||
|
||||
if self.install_layout:
|
||||
if not self.install_layout.lower() in ['deb']:
|
||||
raise DistutilsOptionError("unknown value for --install-layout")
|
||||
self.install_layout = self.install_layout.lower()
|
||||
import sysconfig
|
||||
if sys.version_info[:2] >= (3, 3):
|
||||
self.multiarch = sysconfig.get_config_var('MULTIARCH')
|
||||
self._expand('install_dir', 'script_dir', 'build_directory',
|
||||
'site_dirs')
|
||||
# If a non-default installation directory was specified, default the
|
||||
|
|
@ -282,6 +296,15 @@ class easy_install(Command):
|
|||
if self.user and self.install_purelib:
|
||||
self.install_dir = self.install_purelib
|
||||
self.script_dir = self.install_scripts
|
||||
|
||||
if self.prefix == '/usr' and not self.force_installation_into_system_dir:
|
||||
raise DistutilsOptionError("""installation into /usr
|
||||
|
||||
Trying to install into the system managed parts of the file system. Please
|
||||
consider to install to another location, or use the option
|
||||
--force-installation-into-system-dir to overwrite this warning.
|
||||
""")
|
||||
|
||||
# default --record from the install command
|
||||
self.set_undefined_options('install', ('record', 'record'))
|
||||
# Should this be moved to the if statement below? It's not used
|
||||
|
|
@ -1277,11 +1300,28 @@ class easy_install(Command):
|
|||
self.debug_print("os.makedirs('%s', 0o700)" % path)
|
||||
os.makedirs(path, 0o700)
|
||||
|
||||
if sys.version[:3] in ('2.3', '2.4', '2.5') or 'real_prefix' in sys.__dict__:
|
||||
sitedir_name = 'site-packages'
|
||||
else:
|
||||
sitedir_name = 'dist-packages'
|
||||
|
||||
INSTALL_SCHEMES = dict(
|
||||
posix=dict(
|
||||
install_dir='$base/lib/python$py_version_short/site-packages',
|
||||
script_dir='$base/bin',
|
||||
),
|
||||
unix_local = dict(
|
||||
install_dir = '$base/local/lib/python$py_version_short/%s' % sitedir_name,
|
||||
script_dir = '$base/local/bin',
|
||||
),
|
||||
posix_local = dict(
|
||||
install_dir = '$base/local/lib/python$py_version_short/%s' % sitedir_name,
|
||||
script_dir = '$base/local/bin',
|
||||
),
|
||||
deb_system = dict(
|
||||
install_dir = '$base/lib/python3/%s' % sitedir_name,
|
||||
script_dir = '$base/bin',
|
||||
),
|
||||
)
|
||||
|
||||
DEFAULT_SCHEME = dict(
|
||||
|
|
@ -1292,11 +1332,18 @@ class easy_install(Command):
|
|||
def _expand(self, *attrs):
|
||||
config_vars = self.get_finalized_command('install').config_vars
|
||||
|
||||
if self.prefix:
|
||||
if self.prefix or self.install_layout:
|
||||
if self.install_layout and self.install_layout in ['deb']:
|
||||
scheme_name = "deb_system"
|
||||
self.prefix = '/usr'
|
||||
elif self.prefix or 'real_prefix' in sys.__dict__:
|
||||
scheme_name = os.name
|
||||
else:
|
||||
scheme_name = "posix_local"
|
||||
# Set default install_dir/scripts from --prefix
|
||||
config_vars = config_vars.copy()
|
||||
config_vars['base'] = self.prefix
|
||||
scheme = self.INSTALL_SCHEMES.get(os.name, self.DEFAULT_SCHEME)
|
||||
scheme = self.INSTALL_SCHEMES.get(scheme_name,self.DEFAULT_SCHEME)
|
||||
for attr, val in scheme.items():
|
||||
if getattr(self, attr, None) is None:
|
||||
setattr(self, attr, val)
|
||||
|
|
@ -1330,9 +1377,14 @@ def get_site_dirs():
|
|||
"site-packages"),
|
||||
os.path.join(prefix, "lib", "site-python")])
|
||||
else:
|
||||
if sys.version[:3] in ('2.3', '2.4', '2.5'):
|
||||
sdir = "site-packages"
|
||||
else:
|
||||
sdir = "dist-packages"
|
||||
sitedirs.extend(
|
||||
[prefix, os.path.join(prefix, "lib", "site-packages")]
|
||||
)
|
||||
[os.path.join(prefix, "local/lib", "python" + sys.version[:3], sdir),
|
||||
os.path.join(prefix, "lib", "python" + sys.version[:3], sdir)]
|
||||
)
|
||||
if sys.platform == 'darwin':
|
||||
# for framework builds *only* we add the standard Apple
|
||||
# locations. Currently only per-user, but /Library and
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from distutils import log, dir_util
|
||||
import os
|
||||
import os, sys
|
||||
|
||||
from setuptools.extern.six.moves import map
|
||||
|
||||
|
|
@ -19,14 +19,31 @@ class install_egg_info(Command):
|
|||
|
||||
def initialize_options(self):
|
||||
self.install_dir = None
|
||||
self.install_layout = None
|
||||
self.prefix_option = None
|
||||
|
||||
def finalize_options(self):
|
||||
self.set_undefined_options('install_lib',
|
||||
('install_dir', 'install_dir'))
|
||||
self.set_undefined_options('install',('install_layout','install_layout'))
|
||||
if sys.hexversion > 0x2060000:
|
||||
self.set_undefined_options('install',('prefix_option','prefix_option'))
|
||||
ei_cmd = self.get_finalized_command("egg_info")
|
||||
basename = pkg_resources.Distribution(
|
||||
None, None, ei_cmd.egg_name, ei_cmd.egg_version
|
||||
).egg_name() + '.egg-info'
|
||||
|
||||
if self.install_layout:
|
||||
if not self.install_layout.lower() in ['deb']:
|
||||
raise DistutilsOptionError("unknown value for --install-layout")
|
||||
self.install_layout = self.install_layout.lower()
|
||||
basename = basename.replace('-py%s' % pkg_resources.PY_MAJOR, '')
|
||||
elif self.prefix_option or 'real_prefix' in sys.__dict__:
|
||||
# don't modify for virtualenv
|
||||
pass
|
||||
else:
|
||||
basename = basename.replace('-py%s' % pkg_resources.PY_MAJOR, '')
|
||||
|
||||
self.source = ei_cmd.egg_info
|
||||
self.target = os.path.join(self.install_dir, basename)
|
||||
self.outputs = []
|
||||
|
|
@ -56,6 +73,9 @@ class install_egg_info(Command):
|
|||
for skip in '.svn/', 'CVS/':
|
||||
if src.startswith(skip) or '/' + skip in src:
|
||||
return None
|
||||
if self.install_layout and self.install_layout in ['deb'] and src.startswith('SOURCES.txt'):
|
||||
log.info("Skipping SOURCES.txt")
|
||||
return None
|
||||
self.outputs.append(dst)
|
||||
log.debug("Copying %s to %s", src, dst)
|
||||
return dst
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import os
|
||||
import sys
|
||||
import imp
|
||||
from itertools import product, starmap
|
||||
import distutils.command.install_lib as orig
|
||||
|
|
@ -6,6 +7,18 @@ import distutils.command.install_lib as orig
|
|||
class install_lib(orig.install_lib):
|
||||
"""Don't add compiled flags to filenames of non-Python files"""
|
||||
|
||||
def initialize_options(self):
|
||||
orig.install_lib.initialize_options(self)
|
||||
self.multiarch = None
|
||||
self.install_layout = None
|
||||
|
||||
def finalize_options(self):
|
||||
orig.install_lib.finalize_options(self)
|
||||
self.set_undefined_options('install',('install_layout','install_layout'))
|
||||
if self.install_layout == 'deb' and sys.version_info[:2] >= (3, 3):
|
||||
import sysconfig
|
||||
self.multiarch = sysconfig.get_config_var('MULTIARCH')
|
||||
|
||||
def run(self):
|
||||
self.build()
|
||||
outfiles = self.install()
|
||||
|
|
@ -90,6 +103,8 @@ class install_lib(orig.install_lib):
|
|||
exclude = self.get_exclusions()
|
||||
|
||||
if not exclude:
|
||||
import distutils.dir_util
|
||||
distutils.dir_util._multiarch = self.multiarch
|
||||
return orig.install_lib.copy_tree(self, infile, outfile)
|
||||
|
||||
# Exclude namespace package __init__.py* files from the output
|
||||
|
|
@ -99,12 +114,24 @@ class install_lib(orig.install_lib):
|
|||
|
||||
outfiles = []
|
||||
|
||||
if self.multiarch:
|
||||
import sysconfig
|
||||
ext_suffix = sysconfig.get_config_var ('EXT_SUFFIX')
|
||||
if ext_suffix.endswith(self.multiarch + ext_suffix[-3:]):
|
||||
new_suffix = None
|
||||
else:
|
||||
new_suffix = "%s-%s%s" % (ext_suffix[:-3], self.multiarch, ext_suffix[-3:])
|
||||
|
||||
def pf(src, dst):
|
||||
if dst in exclude:
|
||||
log.warn("Skipping installation of %s (namespace package)",
|
||||
dst)
|
||||
return False
|
||||
|
||||
if self.multiarch and new_suffix and dst.endswith(ext_suffix) and not dst.endswith(new_suffix):
|
||||
dst = dst.replace(ext_suffix, new_suffix)
|
||||
log.info("renaming extension to %s", os.path.basename(dst))
|
||||
|
||||
log.info("copying %s -> %s", src, os.path.dirname(dst))
|
||||
outfiles.append(dst)
|
||||
return dst
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue