Permalink
Browse files

Many fixes: now it seems it installs all the needed eggs

  • Loading branch information...
Alvaro Saurin
Alvaro Saurin committed Mar 15, 2013
1 parent 5838b8c commit ee4ae08abc9fcaf2b296838d5c134dc6ea9286b2
Showing with 147 additions and 190 deletions.
  1. +8 −2 Makefile
  2. +40 −14 as/recipe/frozenpkg/frozen.py
  3. +11 −2 setup.py
  4. +6 −4 testing/Makefile
  5. +59 −151 testing/bootstrap.py
  6. +11 −5 testing/buildout.cfg
  7. +12 −12 testing/setup.py
View
@@ -1,18 +1,24 @@
-PYTHON=python2.6
+PYTHON=python
all: build
build:
$(PYTHON) ./setup.py bdist_egg sdist
+upload-register:
+ @echo 'Registering at Pypi... (settings from ~/.pydistutils.cfg)'
+ $(PYTHON) ./setup.py register
+
upload: build
+ @echo 'Uploading file... (settings from ~/.pydistutils.cfg)'
$(PYTHON) ./setup.py bdist_egg sdist upload
clean:
rm -rf dist build *.egg-info
distclean: clean
- rm -rf bin develop-eggs eggs parts
+ rm -rf bin develop-eggs eggs parts temp
rm -f `find . -name '*.pyc'`
+ make -C testing distclean
@@ -5,16 +5,22 @@
import shutil
import logging
import glob
-
+import re
+import pkg_resources
import subprocess
-import logging
logger = logging.getLogger(__name__)
+#: list of regular expressions for eggs that we will not copy
+SKIP_EGGS = [
+ 'zc.recipe.egg-.*',
+]
+
+
################################################################################
class Frozen(object):
@@ -72,23 +78,43 @@ def _copy_eggs (self, root_dir):
Copy all the required eggs to the virtualenv
"""
bin_dir = os.path.join(root_dir, 'bin')
-
easy_install = os.path.join(bin_dir, 'easy_install')
if not os.path.exists(easy_install):
logger.critical('could not find easy_install at %s' % easy_install )
sys.exit(1)
- logger.debug('Copying eggs')
- eggs_dir = os.path.join(self.buildout['buildout']['directory'], 'eggs')
- for egg in glob.glob(os.path.join(eggs_dir, '*.egg')):
- logger.debug('... copying "%s"' % egg)
- command = [easy_install, '--no-deps', egg]
- job = subprocess.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
- stdout, _ = job.communicate()
-
- if job.returncode != 0:
- logger.critical('could run easy_install: %s' % stdout)
- raise Exception(stdout)
+ distributions = [
+ r.strip()
+ for r in self.options.get('eggs', self.name).split('\n')
+ if r.strip()]
+
+ import zc.buildout.easy_install
+ ws = zc.buildout.easy_install.working_set(
+ distributions,
+ [self.buildout['buildout']['develop-eggs-directory'], self.buildout['buildout']['eggs-directory']]
+ )
+
+ for dist in ws:
+ if any([re.match(pattern, dist.location) for pattern in SKIP_EGGS]):
+ ## skip the eggs in SKIP_EGGS
+ logger.debug('... skipping "%s"' % dist.location)
+ else:
+ logger.debug('... installing "%s" from "%s"' % (dist.key, dist.location))
+
+ command = [easy_install, '--no-deps', dist.location]
+ job = subprocess.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
+ stdout, _ = job.communicate()
+
+ if job.returncode != 0:
+ logger.debug('...... retrying with easy_install')
+ command = [easy_install, "%s==%s" % (dist.key, dist.version)]
+ job = subprocess.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
+ stdout, _ = job.communicate()
+
+ if job.returncode != 0:
+ logger.critical('could run easy_install: %s' % stdout)
+ raise Exception(stdout)
+
def _copy_outputs(self, root_dir):
"""
View
@@ -3,6 +3,10 @@
from setuptools import setup, find_packages
import os
+
+__VERSION__ = '0.2.15'
+
+
#def read(*rnames):
# return open(os.path.join(os.path.dirname(__file__), *rnames), "r").read()
@@ -113,7 +117,7 @@
name = "as.recipe.frozenpkg",
description = "ZC Buildout recipe for freezing buildouts in RPM's, tar.gz's, etc",
long_description = long_description,
- version = '0.2.13',
+ version = __VERSION__,
# Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers
classifiers = [
@@ -123,15 +127,20 @@
'Topic :: Software Development :: Libraries :: Python Modules',
'License :: OSI Approved :: GNU General Public License (GPL)',
],
+
keywords = 'buildout recipe',
author = 'Alvaro Saurin',
author_email = 'name dot surname at gmail.com',
packages = find_packages(exclude = ['ez_setup']),
- namespace_packages = ['as', 'as.recipe'],
+
+ namespace_packages = ['as',
+ 'as.recipe'],
+
include_package_data = True,
install_requires = [
'distribute',
+ 'virtualenv',
],
license = 'GPL',
View
@@ -1,14 +1,16 @@
-PYTHON=python2.6
+PYTHON=python
all: build
bin/buildout:
$(PYTHON) bootstrap.py
build: bin/buildout
- bin/buildout
+ bin/buildout -v -v
distclean:
- rm -rf bin develop-eggs eggs parts
- rm -rf *.tar.gz *.rpm
+ rm -rf bin build develop-eggs eggs parts temp
+ rm -rf *.tar.gz *.rpm *.egg-info
+
+clean: distclean
Oops, something went wrong.

0 comments on commit ee4ae08

Please sign in to comment.