diff options
author | Nishanth Amuluru | 2011-01-08 11:20:57 +0530 |
---|---|---|
committer | Nishanth Amuluru | 2011-01-08 11:20:57 +0530 |
commit | 65411d01d448ff0cd4abd14eee14cf60b5f8fc20 (patch) | |
tree | b4c404363c4c63a61d6e2f8bd26c5b057c1fb09d /eggs/zc.recipe.egg-1.3.2-py2.6.egg/zc/recipe/egg/egg.py | |
parent | 2e35094d43b4cc6974172e1febf76abb50f086ec (diff) | |
download | pytask-65411d01d448ff0cd4abd14eee14cf60b5f8fc20.tar.gz pytask-65411d01d448ff0cd4abd14eee14cf60b5f8fc20.tar.bz2 pytask-65411d01d448ff0cd4abd14eee14cf60b5f8fc20.zip |
Added buildout stuff and made changes accordingly
--HG--
rename : profile/management/__init__.py => eggs/djangorecipe-0.20-py2.6.egg/EGG-INFO/dependency_links.txt
rename : profile/management/__init__.py => eggs/djangorecipe-0.20-py2.6.egg/EGG-INFO/not-zip-safe
rename : profile/management/__init__.py => eggs/infrae.subversion-1.4.5-py2.6.egg/EGG-INFO/dependency_links.txt
rename : profile/management/__init__.py => eggs/infrae.subversion-1.4.5-py2.6.egg/EGG-INFO/not-zip-safe
rename : profile/management/__init__.py => eggs/mercurial-1.7.3-py2.6-linux-x86_64.egg/EGG-INFO/dependency_links.txt
rename : profile/management/__init__.py => eggs/mercurial-1.7.3-py2.6-linux-x86_64.egg/EGG-INFO/not-zip-safe
rename : profile/management/__init__.py => eggs/py-1.4.0-py2.6.egg/EGG-INFO/dependency_links.txt
rename : profile/management/__init__.py => eggs/py-1.4.0-py2.6.egg/EGG-INFO/not-zip-safe
rename : profile/management/__init__.py => eggs/zc.buildout-1.5.2-py2.6.egg/EGG-INFO/dependency_links.txt
rename : profile/management/__init__.py => eggs/zc.buildout-1.5.2-py2.6.egg/EGG-INFO/not-zip-safe
rename : profile/management/__init__.py => eggs/zc.recipe.egg-1.3.2-py2.6.egg/EGG-INFO/dependency_links.txt
rename : profile/management/__init__.py => eggs/zc.recipe.egg-1.3.2-py2.6.egg/EGG-INFO/not-zip-safe
rename : profile/management/__init__.py => parts/django/Django.egg-info/dependency_links.txt
rename : taskapp/models.py => parts/django/django/conf/app_template/models.py
rename : taskapp/tests.py => parts/django/django/conf/app_template/tests.py
rename : taskapp/views.py => parts/django/django/conf/app_template/views.py
rename : taskapp/views.py => parts/django/django/contrib/gis/tests/geo3d/views.py
rename : profile/management/__init__.py => parts/django/tests/modeltests/delete/__init__.py
rename : profile/management/__init__.py => parts/django/tests/modeltests/files/__init__.py
rename : profile/management/__init__.py => parts/django/tests/modeltests/invalid_models/__init__.py
rename : profile/management/__init__.py => parts/django/tests/modeltests/m2m_signals/__init__.py
rename : profile/management/__init__.py => parts/django/tests/modeltests/model_package/__init__.py
rename : profile/management/__init__.py => parts/django/tests/regressiontests/bash_completion/__init__.py
rename : profile/management/__init__.py => parts/django/tests/regressiontests/bash_completion/management/__init__.py
rename : profile/management/__init__.py => parts/django/tests/regressiontests/bash_completion/management/commands/__init__.py
rename : profile/management/__init__.py => parts/django/tests/regressiontests/bash_completion/models.py
rename : profile/management/__init__.py => parts/django/tests/regressiontests/delete_regress/__init__.py
rename : profile/management/__init__.py => parts/django/tests/regressiontests/file_storage/__init__.py
rename : profile/management/__init__.py => parts/django/tests/regressiontests/max_lengths/__init__.py
rename : profile/forms.py => pytask/profile/forms.py
rename : profile/management/__init__.py => pytask/profile/management/__init__.py
rename : profile/management/commands/seed_db.py => pytask/profile/management/commands/seed_db.py
rename : profile/models.py => pytask/profile/models.py
rename : profile/templatetags/user_tags.py => pytask/profile/templatetags/user_tags.py
rename : taskapp/tests.py => pytask/profile/tests.py
rename : profile/urls.py => pytask/profile/urls.py
rename : profile/utils.py => pytask/profile/utils.py
rename : profile/views.py => pytask/profile/views.py
rename : static/css/base.css => pytask/static/css/base.css
rename : taskapp/tests.py => pytask/taskapp/tests.py
rename : taskapp/views.py => pytask/taskapp/views.py
rename : templates/base.html => pytask/templates/base.html
rename : templates/profile/browse_notifications.html => pytask/templates/profile/browse_notifications.html
rename : templates/profile/edit.html => pytask/templates/profile/edit.html
rename : templates/profile/view.html => pytask/templates/profile/view.html
rename : templates/profile/view_notification.html => pytask/templates/profile/view_notification.html
rename : templates/registration/activate.html => pytask/templates/registration/activate.html
rename : templates/registration/activation_email.txt => pytask/templates/registration/activation_email.txt
rename : templates/registration/activation_email_subject.txt => pytask/templates/registration/activation_email_subject.txt
rename : templates/registration/logged_out.html => pytask/templates/registration/logged_out.html
rename : templates/registration/login.html => pytask/templates/registration/login.html
rename : templates/registration/logout.html => pytask/templates/registration/logout.html
rename : templates/registration/password_change_done.html => pytask/templates/registration/password_change_done.html
rename : templates/registration/password_change_form.html => pytask/templates/registration/password_change_form.html
rename : templates/registration/password_reset_complete.html => pytask/templates/registration/password_reset_complete.html
rename : templates/registration/password_reset_confirm.html => pytask/templates/registration/password_reset_confirm.html
rename : templates/registration/password_reset_done.html => pytask/templates/registration/password_reset_done.html
rename : templates/registration/password_reset_email.html => pytask/templates/registration/password_reset_email.html
rename : templates/registration/password_reset_form.html => pytask/templates/registration/password_reset_form.html
rename : templates/registration/registration_complete.html => pytask/templates/registration/registration_complete.html
rename : templates/registration/registration_form.html => pytask/templates/registration/registration_form.html
rename : utils.py => pytask/utils.py
Diffstat (limited to 'eggs/zc.recipe.egg-1.3.2-py2.6.egg/zc/recipe/egg/egg.py')
-rw-r--r-- | eggs/zc.recipe.egg-1.3.2-py2.6.egg/zc/recipe/egg/egg.py | 230 |
1 files changed, 230 insertions, 0 deletions
diff --git a/eggs/zc.recipe.egg-1.3.2-py2.6.egg/zc/recipe/egg/egg.py b/eggs/zc.recipe.egg-1.3.2-py2.6.egg/zc/recipe/egg/egg.py new file mode 100644 index 0000000..c19f757 --- /dev/null +++ b/eggs/zc.recipe.egg-1.3.2-py2.6.egg/zc/recipe/egg/egg.py @@ -0,0 +1,230 @@ +############################################################################## +# +# Copyright (c) 2006 Zope Corporation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Install packages as eggs + +$Id: egg.py 115900 2010-08-23 20:26:07Z gary $ +""" + +import UserDict, logging, os, re, zipfile +import zc.buildout +import zc.buildout.easy_install + + +class Eggs(object): + + include_site_packages = allowed_eggs = None + + def __init__(self, buildout, name, options): + self.buildout = buildout + self.name = self.default_eggs = name + if getattr(options, 'query_bool', None) is None: + # Someone is not passing us a zc.buildout.buildout.Options + # object. Maybe we should have a deprecation warning. + # Whatever. + options = _BackwardsSupportOption(options) + self.options = options + b_options = buildout['buildout'] + links = options.get('find-links', b_options['find-links']) + if links: + links = links.split() + options['find-links'] = '\n'.join(links) + else: + links = () + self.links = links + + index = options.get('index', b_options.get('index')) + if index is not None: + options['index'] = index + self.index = index + + allow_hosts = b_options['allow-hosts'] + allow_hosts = tuple([host.strip() for host in allow_hosts.split('\n') + if host.strip()!='']) + self.allow_hosts = allow_hosts + + options['eggs-directory'] = b_options['eggs-directory'] + options['_e'] = options['eggs-directory'] # backward compat. + options['develop-eggs-directory'] = b_options['develop-eggs-directory'] + options['_d'] = options['develop-eggs-directory'] # backward compat. + + python = options.setdefault('python', b_options['python']) + options['executable'] = buildout[python]['executable'] + + def working_set(self, extra=()): + """Separate method to just get the working set + + This is intended for reuse by similar recipes. + """ + options = self.options + b_options = self.buildout['buildout'] + + distributions = [ + r.strip() + for r in options.get('eggs', self.default_eggs).split('\n') + if r.strip()] + orig_distributions = distributions[:] + distributions.extend(extra) + + if b_options.get('offline') == 'true': + ws = zc.buildout.easy_install.working_set( + distributions, options['executable'], + [options['develop-eggs-directory'], + options['eggs-directory']], + include_site_packages=self.include_site_packages, + allowed_eggs_from_site_packages=self.allowed_eggs, + ) + else: + kw = {} + if 'unzip' in options: + kw['always_unzip'] = options.query_bool('unzip', None) + ws = zc.buildout.easy_install.install( + distributions, options['eggs-directory'], + links=self.links, + index=self.index, + executable=options['executable'], + path=[options['develop-eggs-directory']], + newest=b_options.get('newest') == 'true', + include_site_packages=self.include_site_packages, + allowed_eggs_from_site_packages=self.allowed_eggs, + allow_hosts=self.allow_hosts, + **kw) + + return orig_distributions, ws + + def install(self): + reqs, ws = self.working_set() + return () + + update = install + + +class ScriptBase(Eggs): + + def __init__(self, buildout, name, options): + super(ScriptBase, self).__init__(buildout, name, options) + + b_options = buildout['buildout'] + + options['bin-directory'] = b_options['bin-directory'] + options['_b'] = options['bin-directory'] # backward compat. + + self.extra_paths = [ + os.path.join(b_options['directory'], p.strip()) + for p in options.get('extra-paths', '').split('\n') + if p.strip() + ] + if self.extra_paths: + options['extra-paths'] = '\n'.join(self.extra_paths) + + + relative_paths = options.get( + 'relative-paths', b_options.get('relative-paths', 'false')) + if relative_paths == 'true': + options['buildout-directory'] = b_options['directory'] + self._relative_paths = options['buildout-directory'] + else: + self._relative_paths = '' + assert relative_paths == 'false' + + parse_entry_point = re.compile( + '([^=]+)=(\w+(?:[.]\w+)*):(\w+(?:[.]\w+)*)$' + ).match + + def install(self): + reqs, ws = self.working_set() + options = self.options + + scripts = options.get('scripts') + if scripts or scripts is None or options.get('interpreter'): + if scripts is not None: + scripts = scripts.split() + scripts = dict([ + ('=' in s) and s.split('=', 1) or (s, s) + for s in scripts + ]) + + for s in options.get('entry-points', '').split(): + parsed = self.parse_entry_point(s) + if not parsed: + logging.getLogger(self.name).error( + "Cannot parse the entry point %s.", s) + raise zc.buildout.UserError("Invalid entry point") + reqs.append(parsed.groups()) + + if options.query_bool('dependent-scripts', 'false'): + # Generate scripts for all packages in the working set, + # except setuptools. + reqs = list(reqs) + for dist in ws: + name = dist.project_name + if name != 'setuptools' and name not in reqs: + reqs.append(name) + return self._install(reqs, ws, scripts) + return () + + update = install + + def _install(self, reqs, ws, scripts): + # Subclasses implement this. + raise NotImplementedError() + + +class Scripts(ScriptBase): + + def _install(self, reqs, ws, scripts): + options = self.options + return zc.buildout.easy_install.scripts( + reqs, ws, options['executable'], + options['bin-directory'], + scripts=scripts, + extra_paths=self.extra_paths, + interpreter=options.get('interpreter'), + initialization=options.get('initialization', ''), + arguments=options.get('arguments', ''), + relative_paths=self._relative_paths + ) + +Egg = Scripts + + +class _BackwardsSupportOption(UserDict.UserDict): + + def __init__(self, data): + self.data = data # We want to show mutations to the underlying dict. + + def query_bool(self, name, default=None): + """Given a name, return a boolean value for that name. + + ``default``, if given, should be 'true', 'false', or None. + """ + if default is not None: + value = self.setdefault(name, default) + else: + value = self.get(name) + if value is None: + return value + return _convert_bool(name, value) + + def get_bool(self, name): + """Given a name, return a boolean value for that name. + """ + return _convert_bool(name, self[name]) + + +def _convert_bool(name, value): + if value not in ('true', 'false'): + raise zc.buildout.UserError( + 'Invalid value for %s option: %s' % (name, value)) + else: + return value == 'true' |