Commit 5c99921b authored by Xavier Thompson's avatar Xavier Thompson

Revert "WIP attempt to do --respect-pinned"

This reverts commit b0859c20.
parent b0859c20
...@@ -607,21 +607,18 @@ class Buildout(DictMixin): ...@@ -607,21 +607,18 @@ class Buildout(DictMixin):
def bootstrap(self, args): def bootstrap(self, args):
__doing__ = 'Bootstrapping.' __doing__ = 'Bootstrapping.'
options = self['buildout'] if os.path.exists(self['buildout']['develop-eggs-directory']):
eggs_dir = options['eggs-directory'] if os.path.isdir(self['buildout']['develop-eggs-directory']):
develop_eggs_dir = options['develop-eggs-directory'] rmtree(self['buildout']['develop-eggs-directory'])
self._logger.debug(
if os.path.exists(develop_eggs_dir): "Removed existing develop-eggs directory")
if os.path.isdir(develop_eggs_dir):
rmtree(develop_eggs_dir)
self._logger.debug("Removed existing develop-eggs directory")
self._setup_directories() self._setup_directories()
if '--respect-pinned' in args: if '--all-local' in args:
# Now install buildout and dependent eggs # Now install buildout and dependent eggs, and record destination eggs:
dest = eggs_dir dest = self['buildout']['eggs-directory']
path = [develop_eggs_dir] path = [self['buildout']['develop-eggs-directory']]
if self.offline: if self.offline:
# Cannot install: just check requirements are already met # Cannot install: just check requirements are already met
path.append(dest) path.append(dest)
...@@ -630,46 +627,43 @@ class Buildout(DictMixin): ...@@ -630,46 +627,43 @@ class Buildout(DictMixin):
['zc.buildout'], ['zc.buildout'],
dest, dest,
links=self._links, links=self._links,
index=options.get('index'), index=self['buildout'].get('index'),
path=path, path=path,
newest=self.newest, newest=self.newest,
allow_hosts=self._allow_hosts, allow_hosts=self._allow_hosts,
) )
else: else:
ws = zc.buildout.easy_install.buildout_and_setuptools_dists # Now copy buildout and setuptools eggs, and record destination eggs:
entries = []
# Now copy buildout and setuptools eggs, and record destination eggs: for dist in zc.buildout.easy_install.buildout_and_setuptools_dists:
entries = [] if dist.precedence == pkg_resources.DEVELOP_DIST:
for dist in ws.require('zc.buildout'): dest = os.path.join(self['buildout']['develop-eggs-directory'],
print(dist) dist.key + '.egg-link')
if os.path.dirname(dist.location) in (eggs_dir, develop_eggs_dir): with open(dest, 'w') as fh:
print("ok ", dist.location) fh.write(dist.location)
entries.append(dist.location) entries.append(dist.location)
elif dist.precedence == pkg_resources.DEVELOP_DIST: else:
dest = os.path.join(self['buildout']['develop-eggs-directory'], dest = os.path.join(self['buildout']['eggs-directory'],
dist.key + '.egg-link') os.path.basename(dist.location))
with open(dest, 'w') as fh: entries.append(dest)
fh.write(dist.location) if not os.path.exists(dest):
print("dev", dist.location) if os.path.isdir(dist.location):
entries.append(dist.location) shutil.copytree(dist.location, dest)
else: else:
dest = os.path.join(self['buildout']['eggs-directory'], shutil.copy2(dist.location, dest)
os.path.basename(dist.location)) ws = pkg_resources.WorkingSet(entries)
print("cpy", dest)
entries.append(dest)
if not os.path.exists(dest):
if os.path.isdir(dist.location):
shutil.copytree(dist.location, dest)
else:
shutil.copy2(dist.location, dest)
ws = pkg_resources.WorkingSet(entries) # Ensure all the requirements are met
ws.require('zc.buildout')
# Create buildout script # Create buildout script
options = self['buildout']
eggs_dir = options['eggs-directory']
develop_eggs_dir = options['develop-eggs-directory']
ws = zc.buildout.easy_install.sort_working_set( ws = zc.buildout.easy_install.sort_working_set(
ws, ws,
eggs_dir=eggs_dir, eggs_dir=eggs_dir,
develop_eggs_dir=None develop_eggs_dir=develop_eggs_dir
) )
zc.buildout.easy_install.scripts( zc.buildout.easy_install.scripts(
['zc.buildout'], ws, sys.executable, ['zc.buildout'], ws, sys.executable,
......
...@@ -69,10 +69,6 @@ default_index_url = os.environ.get( ...@@ -69,10 +69,6 @@ default_index_url = os.environ.get(
) )
logger = logging.getLogger('zc.buildout.easy_install') logger = logging.getLogger('zc.buildout.easy_install')
def info(fmt, *args):
print(fmt % args)
logger.info = info
logger.debug = info
url_match = re.compile('[a-z0-9+.-]+://').match url_match = re.compile('[a-z0-9+.-]+://').match
is_source_encoding_line = re.compile(r'coding[:=]\s*([-\w.]+)').search is_source_encoding_line = re.compile(r'coding[:=]\s*([-\w.]+)').search
...@@ -1958,20 +1954,15 @@ def _move_to_eggs_dir_and_compile(dist, dest): ...@@ -1958,20 +1954,15 @@ def _move_to_eggs_dir_and_compile(dist, dest):
return newdist return newdist
def sort_working_set(ws, eggs_dir, develop_eggs_dir=None): def sort_working_set(ws, eggs_dir, develop_eggs_dir):
develop_paths = set() develop_paths = set()
pattern = os.path.join(develop_eggs_dir, '*.egg-link')
for egg_link in glob.glob(pattern):
with open(egg_link, 'rt') as f:
path = f.readline().strip()
if path:
develop_paths.add(path)
if develop_eggs_dir:
pattern = os.path.join(develop_eggs_dir, '*.egg-link')
for egg_link in glob.glob(pattern):
with open(egg_link, 'rt') as f:
path = f.readline().strip()
if path:
develop_paths.add(path)
print(develop_paths)
print(ws.entries)
print([dist for dist in ws])
sorted_paths = [] sorted_paths = []
egg_paths = [] egg_paths = []
other_paths = [] other_paths = []
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment