Edit File by line
/home/barbar84/www/wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../lib/python2..../site-pac.../pip/req
File: req_install.py
from __future__ import absolute_import
[0] Fix | Delete
[1] Fix | Delete
import logging
[2] Fix | Delete
import os
[3] Fix | Delete
import re
[4] Fix | Delete
import shutil
[5] Fix | Delete
import sys
[6] Fix | Delete
import tempfile
[7] Fix | Delete
import traceback
[8] Fix | Delete
import warnings
[9] Fix | Delete
import zipfile
[10] Fix | Delete
[11] Fix | Delete
from distutils import sysconfig
[12] Fix | Delete
from distutils.util import change_root
[13] Fix | Delete
from email.parser import FeedParser
[14] Fix | Delete
[15] Fix | Delete
from pip._vendor import pkg_resources, six
[16] Fix | Delete
from pip._vendor.packaging import specifiers
[17] Fix | Delete
from pip._vendor.packaging.markers import Marker
[18] Fix | Delete
from pip._vendor.packaging.requirements import InvalidRequirement, Requirement
[19] Fix | Delete
from pip._vendor.packaging.utils import canonicalize_name
[20] Fix | Delete
from pip._vendor.packaging.version import Version, parse as parse_version
[21] Fix | Delete
from pip._vendor.six.moves import configparser
[22] Fix | Delete
[23] Fix | Delete
import pip.wheel
[24] Fix | Delete
[25] Fix | Delete
from pip.compat import native_str, get_stdlib, WINDOWS
[26] Fix | Delete
from pip.download import is_url, url_to_path, path_to_url, is_archive_file
[27] Fix | Delete
from pip.exceptions import (
[28] Fix | Delete
InstallationError, UninstallationError,
[29] Fix | Delete
)
[30] Fix | Delete
from pip.locations import (
[31] Fix | Delete
bin_py, running_under_virtualenv, PIP_DELETE_MARKER_FILENAME, bin_user,
[32] Fix | Delete
)
[33] Fix | Delete
from pip.utils import (
[34] Fix | Delete
display_path, rmtree, ask_path_exists, backup_dir, is_installable_dir,
[35] Fix | Delete
dist_in_usersite, dist_in_site_packages, egg_link_path,
[36] Fix | Delete
call_subprocess, read_text_file, FakeFile, _make_build_dir, ensure_dir,
[37] Fix | Delete
get_installed_version, normalize_path, dist_is_local,
[38] Fix | Delete
)
[39] Fix | Delete
[40] Fix | Delete
from pip.utils.hashes import Hashes
[41] Fix | Delete
from pip.utils.deprecation import RemovedInPip10Warning
[42] Fix | Delete
from pip.utils.logging import indent_log
[43] Fix | Delete
from pip.utils.setuptools_build import SETUPTOOLS_SHIM
[44] Fix | Delete
from pip.utils.ui import open_spinner
[45] Fix | Delete
from pip.req.req_uninstall import UninstallPathSet
[46] Fix | Delete
from pip.vcs import vcs
[47] Fix | Delete
from pip.wheel import move_wheel_files, Wheel
[48] Fix | Delete
[49] Fix | Delete
[50] Fix | Delete
logger = logging.getLogger(__name__)
[51] Fix | Delete
[52] Fix | Delete
operators = specifiers.Specifier._operators.keys()
[53] Fix | Delete
[54] Fix | Delete
[55] Fix | Delete
def _strip_extras(path):
[56] Fix | Delete
m = re.match(r'^(.+)(\[[^\]]+\])$', path)
[57] Fix | Delete
extras = None
[58] Fix | Delete
if m:
[59] Fix | Delete
path_no_extras = m.group(1)
[60] Fix | Delete
extras = m.group(2)
[61] Fix | Delete
else:
[62] Fix | Delete
path_no_extras = path
[63] Fix | Delete
[64] Fix | Delete
return path_no_extras, extras
[65] Fix | Delete
[66] Fix | Delete
[67] Fix | Delete
def _safe_extras(extras):
[68] Fix | Delete
return set(pkg_resources.safe_extra(extra) for extra in extras)
[69] Fix | Delete
[70] Fix | Delete
[71] Fix | Delete
class InstallRequirement(object):
[72] Fix | Delete
[73] Fix | Delete
def __init__(self, req, comes_from, source_dir=None, editable=False,
[74] Fix | Delete
link=None, as_egg=False, update=True,
[75] Fix | Delete
pycompile=True, markers=None, isolated=False, options=None,
[76] Fix | Delete
wheel_cache=None, constraint=False):
[77] Fix | Delete
self.extras = ()
[78] Fix | Delete
if isinstance(req, six.string_types):
[79] Fix | Delete
try:
[80] Fix | Delete
req = Requirement(req)
[81] Fix | Delete
except InvalidRequirement:
[82] Fix | Delete
if os.path.sep in req:
[83] Fix | Delete
add_msg = "It looks like a path. Does it exist ?"
[84] Fix | Delete
elif '=' in req and not any(op in req for op in operators):
[85] Fix | Delete
add_msg = "= is not a valid operator. Did you mean == ?"
[86] Fix | Delete
else:
[87] Fix | Delete
add_msg = traceback.format_exc()
[88] Fix | Delete
raise InstallationError(
[89] Fix | Delete
"Invalid requirement: '%s'\n%s" % (req, add_msg))
[90] Fix | Delete
self.extras = _safe_extras(req.extras)
[91] Fix | Delete
[92] Fix | Delete
self.req = req
[93] Fix | Delete
self.comes_from = comes_from
[94] Fix | Delete
self.constraint = constraint
[95] Fix | Delete
self.source_dir = source_dir
[96] Fix | Delete
self.editable = editable
[97] Fix | Delete
[98] Fix | Delete
self._wheel_cache = wheel_cache
[99] Fix | Delete
self.link = self.original_link = link
[100] Fix | Delete
self.as_egg = as_egg
[101] Fix | Delete
if markers is not None:
[102] Fix | Delete
self.markers = markers
[103] Fix | Delete
else:
[104] Fix | Delete
self.markers = req and req.marker
[105] Fix | Delete
self._egg_info_path = None
[106] Fix | Delete
# This holds the pkg_resources.Distribution object if this requirement
[107] Fix | Delete
# is already available:
[108] Fix | Delete
self.satisfied_by = None
[109] Fix | Delete
# This hold the pkg_resources.Distribution object if this requirement
[110] Fix | Delete
# conflicts with another installed distribution:
[111] Fix | Delete
self.conflicts_with = None
[112] Fix | Delete
# Temporary build location
[113] Fix | Delete
self._temp_build_dir = None
[114] Fix | Delete
# Used to store the global directory where the _temp_build_dir should
[115] Fix | Delete
# have been created. Cf _correct_build_location method.
[116] Fix | Delete
self._ideal_build_dir = None
[117] Fix | Delete
# True if the editable should be updated:
[118] Fix | Delete
self.update = update
[119] Fix | Delete
# Set to True after successful installation
[120] Fix | Delete
self.install_succeeded = None
[121] Fix | Delete
# UninstallPathSet of uninstalled distribution (for possible rollback)
[122] Fix | Delete
self.uninstalled = None
[123] Fix | Delete
# Set True if a legitimate do-nothing-on-uninstall has happened - e.g.
[124] Fix | Delete
# system site packages, stdlib packages.
[125] Fix | Delete
self.nothing_to_uninstall = False
[126] Fix | Delete
self.use_user_site = False
[127] Fix | Delete
self.target_dir = None
[128] Fix | Delete
self.options = options if options else {}
[129] Fix | Delete
self.pycompile = pycompile
[130] Fix | Delete
# Set to True after successful preparation of this requirement
[131] Fix | Delete
self.prepared = False
[132] Fix | Delete
[133] Fix | Delete
self.isolated = isolated
[134] Fix | Delete
[135] Fix | Delete
@classmethod
[136] Fix | Delete
def from_editable(cls, editable_req, comes_from=None, default_vcs=None,
[137] Fix | Delete
isolated=False, options=None, wheel_cache=None,
[138] Fix | Delete
constraint=False):
[139] Fix | Delete
from pip.index import Link
[140] Fix | Delete
[141] Fix | Delete
name, url, extras_override = parse_editable(
[142] Fix | Delete
editable_req, default_vcs)
[143] Fix | Delete
if url.startswith('file:'):
[144] Fix | Delete
source_dir = url_to_path(url)
[145] Fix | Delete
else:
[146] Fix | Delete
source_dir = None
[147] Fix | Delete
[148] Fix | Delete
res = cls(name, comes_from, source_dir=source_dir,
[149] Fix | Delete
editable=True,
[150] Fix | Delete
link=Link(url),
[151] Fix | Delete
constraint=constraint,
[152] Fix | Delete
isolated=isolated,
[153] Fix | Delete
options=options if options else {},
[154] Fix | Delete
wheel_cache=wheel_cache)
[155] Fix | Delete
[156] Fix | Delete
if extras_override is not None:
[157] Fix | Delete
res.extras = _safe_extras(extras_override)
[158] Fix | Delete
[159] Fix | Delete
return res
[160] Fix | Delete
[161] Fix | Delete
@classmethod
[162] Fix | Delete
def from_line(
[163] Fix | Delete
cls, name, comes_from=None, isolated=False, options=None,
[164] Fix | Delete
wheel_cache=None, constraint=False):
[165] Fix | Delete
"""Creates an InstallRequirement from a name, which might be a
[166] Fix | Delete
requirement, directory containing 'setup.py', filename, or URL.
[167] Fix | Delete
"""
[168] Fix | Delete
from pip.index import Link
[169] Fix | Delete
[170] Fix | Delete
if is_url(name):
[171] Fix | Delete
marker_sep = '; '
[172] Fix | Delete
else:
[173] Fix | Delete
marker_sep = ';'
[174] Fix | Delete
if marker_sep in name:
[175] Fix | Delete
name, markers = name.split(marker_sep, 1)
[176] Fix | Delete
markers = markers.strip()
[177] Fix | Delete
if not markers:
[178] Fix | Delete
markers = None
[179] Fix | Delete
else:
[180] Fix | Delete
markers = Marker(markers)
[181] Fix | Delete
else:
[182] Fix | Delete
markers = None
[183] Fix | Delete
name = name.strip()
[184] Fix | Delete
req = None
[185] Fix | Delete
path = os.path.normpath(os.path.abspath(name))
[186] Fix | Delete
link = None
[187] Fix | Delete
extras = None
[188] Fix | Delete
[189] Fix | Delete
if is_url(name):
[190] Fix | Delete
link = Link(name)
[191] Fix | Delete
else:
[192] Fix | Delete
p, extras = _strip_extras(path)
[193] Fix | Delete
if (os.path.isdir(p) and
[194] Fix | Delete
(os.path.sep in name or name.startswith('.'))):
[195] Fix | Delete
[196] Fix | Delete
if not is_installable_dir(p):
[197] Fix | Delete
raise InstallationError(
[198] Fix | Delete
"Directory %r is not installable. File 'setup.py' "
[199] Fix | Delete
"not found." % name
[200] Fix | Delete
)
[201] Fix | Delete
link = Link(path_to_url(p))
[202] Fix | Delete
elif is_archive_file(p):
[203] Fix | Delete
if not os.path.isfile(p):
[204] Fix | Delete
logger.warning(
[205] Fix | Delete
'Requirement %r looks like a filename, but the '
[206] Fix | Delete
'file does not exist',
[207] Fix | Delete
name
[208] Fix | Delete
)
[209] Fix | Delete
link = Link(path_to_url(p))
[210] Fix | Delete
[211] Fix | Delete
# it's a local file, dir, or url
[212] Fix | Delete
if link:
[213] Fix | Delete
# Handle relative file URLs
[214] Fix | Delete
if link.scheme == 'file' and re.search(r'\.\./', link.url):
[215] Fix | Delete
link = Link(
[216] Fix | Delete
path_to_url(os.path.normpath(os.path.abspath(link.path))))
[217] Fix | Delete
# wheel file
[218] Fix | Delete
if link.is_wheel:
[219] Fix | Delete
wheel = Wheel(link.filename) # can raise InvalidWheelFilename
[220] Fix | Delete
req = "%s==%s" % (wheel.name, wheel.version)
[221] Fix | Delete
else:
[222] Fix | Delete
# set the req to the egg fragment. when it's not there, this
[223] Fix | Delete
# will become an 'unnamed' requirement
[224] Fix | Delete
req = link.egg_fragment
[225] Fix | Delete
[226] Fix | Delete
# a requirement specifier
[227] Fix | Delete
else:
[228] Fix | Delete
req = name
[229] Fix | Delete
[230] Fix | Delete
options = options if options else {}
[231] Fix | Delete
res = cls(req, comes_from, link=link, markers=markers,
[232] Fix | Delete
isolated=isolated, options=options,
[233] Fix | Delete
wheel_cache=wheel_cache, constraint=constraint)
[234] Fix | Delete
[235] Fix | Delete
if extras:
[236] Fix | Delete
res.extras = _safe_extras(
[237] Fix | Delete
Requirement('placeholder' + extras).extras)
[238] Fix | Delete
[239] Fix | Delete
return res
[240] Fix | Delete
[241] Fix | Delete
def __str__(self):
[242] Fix | Delete
if self.req:
[243] Fix | Delete
s = str(self.req)
[244] Fix | Delete
if self.link:
[245] Fix | Delete
s += ' from %s' % self.link.url
[246] Fix | Delete
else:
[247] Fix | Delete
s = self.link.url if self.link else None
[248] Fix | Delete
if self.satisfied_by is not None:
[249] Fix | Delete
s += ' in %s' % display_path(self.satisfied_by.location)
[250] Fix | Delete
if self.comes_from:
[251] Fix | Delete
if isinstance(self.comes_from, six.string_types):
[252] Fix | Delete
comes_from = self.comes_from
[253] Fix | Delete
else:
[254] Fix | Delete
comes_from = self.comes_from.from_path()
[255] Fix | Delete
if comes_from:
[256] Fix | Delete
s += ' (from %s)' % comes_from
[257] Fix | Delete
return s
[258] Fix | Delete
[259] Fix | Delete
def __repr__(self):
[260] Fix | Delete
return '<%s object: %s editable=%r>' % (
[261] Fix | Delete
self.__class__.__name__, str(self), self.editable)
[262] Fix | Delete
[263] Fix | Delete
def populate_link(self, finder, upgrade, require_hashes):
[264] Fix | Delete
"""Ensure that if a link can be found for this, that it is found.
[265] Fix | Delete
[266] Fix | Delete
Note that self.link may still be None - if Upgrade is False and the
[267] Fix | Delete
requirement is already installed.
[268] Fix | Delete
[269] Fix | Delete
If require_hashes is True, don't use the wheel cache, because cached
[270] Fix | Delete
wheels, always built locally, have different hashes than the files
[271] Fix | Delete
downloaded from the index server and thus throw false hash mismatches.
[272] Fix | Delete
Furthermore, cached wheels at present have undeterministic contents due
[273] Fix | Delete
to file modification times.
[274] Fix | Delete
"""
[275] Fix | Delete
if self.link is None:
[276] Fix | Delete
self.link = finder.find_requirement(self, upgrade)
[277] Fix | Delete
if self._wheel_cache is not None and not require_hashes:
[278] Fix | Delete
old_link = self.link
[279] Fix | Delete
self.link = self._wheel_cache.cached_wheel(self.link, self.name)
[280] Fix | Delete
if old_link != self.link:
[281] Fix | Delete
logger.debug('Using cached wheel link: %s', self.link)
[282] Fix | Delete
[283] Fix | Delete
@property
[284] Fix | Delete
def specifier(self):
[285] Fix | Delete
return self.req.specifier
[286] Fix | Delete
[287] Fix | Delete
@property
[288] Fix | Delete
def is_pinned(self):
[289] Fix | Delete
"""Return whether I am pinned to an exact version.
[290] Fix | Delete
[291] Fix | Delete
For example, some-package==1.2 is pinned; some-package>1.2 is not.
[292] Fix | Delete
"""
[293] Fix | Delete
specifiers = self.specifier
[294] Fix | Delete
return (len(specifiers) == 1 and
[295] Fix | Delete
next(iter(specifiers)).operator in ('==', '==='))
[296] Fix | Delete
[297] Fix | Delete
def from_path(self):
[298] Fix | Delete
if self.req is None:
[299] Fix | Delete
return None
[300] Fix | Delete
s = str(self.req)
[301] Fix | Delete
if self.comes_from:
[302] Fix | Delete
if isinstance(self.comes_from, six.string_types):
[303] Fix | Delete
comes_from = self.comes_from
[304] Fix | Delete
else:
[305] Fix | Delete
comes_from = self.comes_from.from_path()
[306] Fix | Delete
if comes_from:
[307] Fix | Delete
s += '->' + comes_from
[308] Fix | Delete
return s
[309] Fix | Delete
[310] Fix | Delete
def build_location(self, build_dir):
[311] Fix | Delete
if self._temp_build_dir is not None:
[312] Fix | Delete
return self._temp_build_dir
[313] Fix | Delete
if self.req is None:
[314] Fix | Delete
# for requirement via a path to a directory: the name of the
[315] Fix | Delete
# package is not available yet so we create a temp directory
[316] Fix | Delete
# Once run_egg_info will have run, we'll be able
[317] Fix | Delete
# to fix it via _correct_build_location
[318] Fix | Delete
# Some systems have /tmp as a symlink which confuses custom
[319] Fix | Delete
# builds (such as numpy). Thus, we ensure that the real path
[320] Fix | Delete
# is returned.
[321] Fix | Delete
self._temp_build_dir = os.path.realpath(
[322] Fix | Delete
tempfile.mkdtemp('-build', 'pip-')
[323] Fix | Delete
)
[324] Fix | Delete
self._ideal_build_dir = build_dir
[325] Fix | Delete
return self._temp_build_dir
[326] Fix | Delete
if self.editable:
[327] Fix | Delete
name = self.name.lower()
[328] Fix | Delete
else:
[329] Fix | Delete
name = self.name
[330] Fix | Delete
# FIXME: Is there a better place to create the build_dir? (hg and bzr
[331] Fix | Delete
# need this)
[332] Fix | Delete
if not os.path.exists(build_dir):
[333] Fix | Delete
logger.debug('Creating directory %s', build_dir)
[334] Fix | Delete
_make_build_dir(build_dir)
[335] Fix | Delete
return os.path.join(build_dir, name)
[336] Fix | Delete
[337] Fix | Delete
def _correct_build_location(self):
[338] Fix | Delete
"""Move self._temp_build_dir to self._ideal_build_dir/self.req.name
[339] Fix | Delete
[340] Fix | Delete
For some requirements (e.g. a path to a directory), the name of the
[341] Fix | Delete
package is not available until we run egg_info, so the build_location
[342] Fix | Delete
will return a temporary directory and store the _ideal_build_dir.
[343] Fix | Delete
[344] Fix | Delete
This is only called by self.egg_info_path to fix the temporary build
[345] Fix | Delete
directory.
[346] Fix | Delete
"""
[347] Fix | Delete
if self.source_dir is not None:
[348] Fix | Delete
return
[349] Fix | Delete
assert self.req is not None
[350] Fix | Delete
assert self._temp_build_dir
[351] Fix | Delete
assert self._ideal_build_dir
[352] Fix | Delete
old_location = self._temp_build_dir
[353] Fix | Delete
self._temp_build_dir = None
[354] Fix | Delete
new_location = self.build_location(self._ideal_build_dir)
[355] Fix | Delete
if os.path.exists(new_location):
[356] Fix | Delete
raise InstallationError(
[357] Fix | Delete
'A package already exists in %s; please remove it to continue'
[358] Fix | Delete
% display_path(new_location))
[359] Fix | Delete
logger.debug(
[360] Fix | Delete
'Moving package %s from %s to new location %s',
[361] Fix | Delete
self, display_path(old_location), display_path(new_location),
[362] Fix | Delete
)
[363] Fix | Delete
shutil.move(old_location, new_location)
[364] Fix | Delete
self._temp_build_dir = new_location
[365] Fix | Delete
self._ideal_build_dir = None
[366] Fix | Delete
self.source_dir = new_location
[367] Fix | Delete
self._egg_info_path = None
[368] Fix | Delete
[369] Fix | Delete
@property
[370] Fix | Delete
def name(self):
[371] Fix | Delete
if self.req is None:
[372] Fix | Delete
return None
[373] Fix | Delete
return native_str(pkg_resources.safe_name(self.req.name))
[374] Fix | Delete
[375] Fix | Delete
@property
[376] Fix | Delete
def setup_py_dir(self):
[377] Fix | Delete
return os.path.join(
[378] Fix | Delete
self.source_dir,
[379] Fix | Delete
self.link and self.link.subdirectory_fragment or '')
[380] Fix | Delete
[381] Fix | Delete
@property
[382] Fix | Delete
def setup_py(self):
[383] Fix | Delete
assert self.source_dir, "No source dir for %s" % self
[384] Fix | Delete
try:
[385] Fix | Delete
import setuptools # noqa
[386] Fix | Delete
except ImportError:
[387] Fix | Delete
if get_installed_version('setuptools') is None:
[388] Fix | Delete
add_msg = "Please install setuptools."
[389] Fix | Delete
else:
[390] Fix | Delete
add_msg = traceback.format_exc()
[391] Fix | Delete
# Setuptools is not available
[392] Fix | Delete
raise InstallationError(
[393] Fix | Delete
"Could not import setuptools which is required to "
[394] Fix | Delete
"install from a source distribution.\n%s" % add_msg
[395] Fix | Delete
)
[396] Fix | Delete
[397] Fix | Delete
setup_py = os.path.join(self.setup_py_dir, 'setup.py')
[398] Fix | Delete
[399] Fix | Delete
# Python2 __file__ should not be unicode
[400] Fix | Delete
if six.PY2 and isinstance(setup_py, six.text_type):
[401] Fix | Delete
setup_py = setup_py.encode(sys.getfilesystemencoding())
[402] Fix | Delete
[403] Fix | Delete
return setup_py
[404] Fix | Delete
[405] Fix | Delete
def run_egg_info(self):
[406] Fix | Delete
assert self.source_dir
[407] Fix | Delete
if self.name:
[408] Fix | Delete
logger.debug(
[409] Fix | Delete
'Running setup.py (path:%s) egg_info for package %s',
[410] Fix | Delete
self.setup_py, self.name,
[411] Fix | Delete
)
[412] Fix | Delete
else:
[413] Fix | Delete
logger.debug(
[414] Fix | Delete
'Running setup.py (path:%s) egg_info for package from %s',
[415] Fix | Delete
self.setup_py, self.link,
[416] Fix | Delete
)
[417] Fix | Delete
[418] Fix | Delete
with indent_log():
[419] Fix | Delete
script = SETUPTOOLS_SHIM % self.setup_py
[420] Fix | Delete
base_cmd = [sys.executable, '-c', script]
[421] Fix | Delete
if self.isolated:
[422] Fix | Delete
base_cmd += ["--no-user-cfg"]
[423] Fix | Delete
egg_info_cmd = base_cmd + ['egg_info']
[424] Fix | Delete
# We can't put the .egg-info files at the root, because then the
[425] Fix | Delete
# source code will be mistaken for an installed egg, causing
[426] Fix | Delete
# problems
[427] Fix | Delete
if self.editable:
[428] Fix | Delete
egg_base_option = []
[429] Fix | Delete
else:
[430] Fix | Delete
egg_info_dir = os.path.join(self.setup_py_dir, 'pip-egg-info')
[431] Fix | Delete
ensure_dir(egg_info_dir)
[432] Fix | Delete
egg_base_option = ['--egg-base', 'pip-egg-info']
[433] Fix | Delete
call_subprocess(
[434] Fix | Delete
egg_info_cmd + egg_base_option,
[435] Fix | Delete
cwd=self.setup_py_dir,
[436] Fix | Delete
show_stdout=False,
[437] Fix | Delete
command_desc='python setup.py egg_info')
[438] Fix | Delete
[439] Fix | Delete
if not self.req:
[440] Fix | Delete
if isinstance(parse_version(self.pkg_info()["Version"]), Version):
[441] Fix | Delete
op = "=="
[442] Fix | Delete
else:
[443] Fix | Delete
op = "==="
[444] Fix | Delete
self.req = Requirement(
[445] Fix | Delete
"".join([
[446] Fix | Delete
self.pkg_info()["Name"],
[447] Fix | Delete
op,
[448] Fix | Delete
self.pkg_info()["Version"],
[449] Fix | Delete
])
[450] Fix | Delete
)
[451] Fix | Delete
self._correct_build_location()
[452] Fix | Delete
else:
[453] Fix | Delete
metadata_name = canonicalize_name(self.pkg_info()["Name"])
[454] Fix | Delete
if canonicalize_name(self.req.name) != metadata_name:
[455] Fix | Delete
logger.warning(
[456] Fix | Delete
'Running setup.py (path:%s) egg_info for package %s '
[457] Fix | Delete
'produced metadata for project name %s. Fix your '
[458] Fix | Delete
'#egg=%s fragments.',
[459] Fix | Delete
self.setup_py, self.name, metadata_name, self.name
[460] Fix | Delete
)
[461] Fix | Delete
self.req = Requirement(metadata_name)
[462] Fix | Delete
[463] Fix | Delete
def egg_info_data(self, filename):
[464] Fix | Delete
if self.satisfied_by is not None:
[465] Fix | Delete
if not self.satisfied_by.has_metadata(filename):
[466] Fix | Delete
return None
[467] Fix | Delete
return self.satisfied_by.get_metadata(filename)
[468] Fix | Delete
assert self.source_dir
[469] Fix | Delete
filename = self.egg_info_path(filename)
[470] Fix | Delete
if not os.path.exists(filename):
[471] Fix | Delete
return None
[472] Fix | Delete
data = read_text_file(filename)
[473] Fix | Delete
return data
[474] Fix | Delete
[475] Fix | Delete
def egg_info_path(self, filename):
[476] Fix | Delete
if self._egg_info_path is None:
[477] Fix | Delete
if self.editable:
[478] Fix | Delete
base = self.source_dir
[479] Fix | Delete
else:
[480] Fix | Delete
base = os.path.join(self.setup_py_dir, 'pip-egg-info')
[481] Fix | Delete
filenames = os.listdir(base)
[482] Fix | Delete
if self.editable:
[483] Fix | Delete
filenames = []
[484] Fix | Delete
for root, dirs, files in os.walk(base):
[485] Fix | Delete
for dir in vcs.dirnames:
[486] Fix | Delete
if dir in dirs:
[487] Fix | Delete
dirs.remove(dir)
[488] Fix | Delete
# Iterate over a copy of ``dirs``, since mutating
[489] Fix | Delete
# a list while iterating over it can cause trouble.
[490] Fix | Delete
# (See https://github.com/pypa/pip/pull/462.)
[491] Fix | Delete
for dir in list(dirs):
[492] Fix | Delete
# Don't search in anything that looks like a virtualenv
[493] Fix | Delete
# environment
[494] Fix | Delete
if (
[495] Fix | Delete
os.path.lexists(
[496] Fix | Delete
os.path.join(root, dir, 'bin', 'python')
[497] Fix | Delete
) or
[498] Fix | Delete
os.path.exists(
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function