Commits

Gael Pasgrimaud  committed 98686ae

fix editables

  • Participants
  • Parent commits b254f28

Comments (0)

Files changed (2)

 
  - allow to use extra env vars
 
+ - fix bug with editables
+
+ - allow to share virtualenvs / build_dir between buildouts
+
 0.3 (2008-12-7)
 ==================
 

File gp/recipe/pip/__init__.py

             self.pip_install(part_dir, build_dir, src_dir, ['-e', e])
 
         # packages / bundles. add version if needed
-        for i in to_list(self.options.get('install', '')):
+        installs = to_list(self.options.get('install', ''))
+        for i in installs:
             for k in buildout_versions:
                 if i.endswith(k):
                     i = '%s==%s' % (i, buildout_versions.get(k))
         # prepare options for zc.recipe.egg
 
         # retrieve venv's site-packages and executable
+        executable = get_executable(part_dir)
         site_packages = glob.glob(join(part_dir, 'lib', '*', 'site-packages'))[0]
-        executable = get_executable(part_dir)
+        if site_packages not in sys.path:
+            sys.path.insert(0, site_packages)
 
         # retrieve versions from egg-info
         egg_infos = glob.glob(join(site_packages, '*.egg-info'))
-        eggs = [os.path.basename(p) for p in glob.glob(join(src_dir, '*'))]
+        eggs = []
         versions = []
         for info in egg_infos:
             info = os.path.basename(info)
             name, ver, r = info.split('-', 2)
-            eggs.append(name)
-            versions.append((name, ver))
+            # only add eggs available in install
+            for i in installs:
+                if name in i:
+                    eggs.append(name)
+                    versions.append((name, ver))
         versions = dict(versions)
 
         # update with buildout versions
 
         # set eggs directory and executable
         _options = self.buildout['buildout'].copy()
-        self.buildout['buildout']['develop-eggs-directory'] = site_packages
+        self.buildout['buildout']['newest'] = 'false'
         self.buildout['buildout']['executable'] = executable
 
         # clean copy of options
         for k in self.options:
             options[k] = self.options[k]
 
+        # move .egg-link from site-packages and append develop eggs to eggs list
+        dev_eggs_dir = self.buildout['buildout']['develop-eggs-directory']
+        for filename in glob.glob(join(site_packages, '*.egg-link')):
+            name =  os.path.basename(filename)
+            eggs.append(name.replace('.egg-link', ''))
+            os.rename(filename, join(dev_eggs_dir, name))
+
         # add eggs found in venv to eggs option
         options['eggs'] = '\n'.join(eggs) + '\n' + self.options.get('eggs', '')