[Checkins] SVN: lovely.buildouthttp/trunk/ new buildout plugin

Bernd Dorn bernd.dorn at lovelysystems.com
Thu Jun 14 05:35:14 EDT 2007


Log message for revision 76678:
  new buildout plugin

Changed:
  A   lovely.buildouthttp/trunk/
  A   lovely.buildouthttp/trunk/bootstrap.py
  A   lovely.buildouthttp/trunk/buildout.cfg
  A   lovely.buildouthttp/trunk/setup.py
  A   lovely.buildouthttp/trunk/src/
  A   lovely.buildouthttp/trunk/src/lovely/
  A   lovely.buildouthttp/trunk/src/lovely/__init__.py
  A   lovely.buildouthttp/trunk/src/lovely/buildouthttp/
  A   lovely.buildouthttp/trunk/src/lovely/buildouthttp/__init__.py
  A   lovely.buildouthttp/trunk/src/lovely/buildouthttp/buildouthttp.py

-=-
Added: lovely.buildouthttp/trunk/bootstrap.py
===================================================================
--- lovely.buildouthttp/trunk/bootstrap.py	                        (rev 0)
+++ lovely.buildouthttp/trunk/bootstrap.py	2007-06-14 09:35:13 UTC (rev 76678)
@@ -0,0 +1,56 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+"""Bootstrap a buildout-based project
+
+Simply run this script in a directory containing a buildout.cfg.
+The script accepts buildout command-line options, so you can
+use the -c option to specify an alternate configuration file.
+
+$Id$
+"""
+
+import os, shutil, sys, tempfile, urllib2
+
+tmpeggs = tempfile.mkdtemp()
+
+try:
+    import pkg_resources
+except ImportError:
+    ez = {}
+    exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
+                         ).read() in ez
+    ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
+
+    import pkg_resources
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+if sys.platform == 'win32':
+    cmd = '"%s"' % cmd # work around spawn lamosity on windows
+
+ws = pkg_resources.working_set
+assert os.spawnle(
+    os.P_WAIT, sys.executable, sys.executable,
+    '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout',
+    dict(os.environ,
+         PYTHONPATH=
+         ws.find(pkg_resources.Requirement.parse('setuptools')).location
+         ),
+    ) == 0
+
+ws.add_entry(tmpeggs)
+ws.require('zc.buildout')
+import zc.buildout.buildout
+zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
+shutil.rmtree(tmpeggs)
+


Property changes on: lovely.buildouthttp/trunk/bootstrap.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: lovely.buildouthttp/trunk/buildout.cfg
===================================================================
--- lovely.buildouthttp/trunk/buildout.cfg	                        (rev 0)
+++ lovely.buildouthttp/trunk/buildout.cfg	2007-06-14 09:35:13 UTC (rev 76678)
@@ -0,0 +1,12 @@
+[buildout]
+develop = .
+parts = test
+find-links = ${download.lovelysystems.com:url}
+extensions = lovely.buildouthttp
+
+[test]
+# test to download an egg from lovelysystems
+recipe = zc.recipe.egg
+eggs = lovely.devtools
+
+


Property changes on: lovely.buildouthttp/trunk/buildout.cfg
___________________________________________________________________
Name: svn:eol-style
   + native

Added: lovely.buildouthttp/trunk/setup.py
===================================================================
--- lovely.buildouthttp/trunk/setup.py	                        (rev 0)
+++ lovely.buildouthttp/trunk/setup.py	2007-06-14 09:35:13 UTC (rev 76678)
@@ -0,0 +1,22 @@
+from setuptools import setup, find_packages
+
+name='lovely.buildouthttp'
+setup(
+    name=name,
+    version = "0.1.0a1",
+    author = "Lovely Systems",
+    author_email = "office at lovelysystems.com",
+    description = "Specialized zc.buildout plugin to add http basic" \
+                  "authentication support with a pwd file.",
+    license = "ZPL 2.1",
+    keywords = "buildout http authentication",
+    packages = find_packages('src'),
+    include_package_data = True,
+    package_dir = {'':'src'},
+    namespace_packages = ['lovely'],
+    install_requires = ['setuptools'],
+    zip_safe=False,
+    entry_points = {'zc.buildout.extension':
+                    ['default = %s.buildouthttp:install' % name]
+                    },
+    )


Property changes on: lovely.buildouthttp/trunk/setup.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: lovely.buildouthttp/trunk/src/lovely/__init__.py
===================================================================
--- lovely.buildouthttp/trunk/src/lovely/__init__.py	                        (rev 0)
+++ lovely.buildouthttp/trunk/src/lovely/__init__.py	2007-06-14 09:35:13 UTC (rev 76678)
@@ -0,0 +1,7 @@
+# this is a namespace package
+try:
+    import pkg_resources
+    pkg_resources.declare_namespace(__name__)
+except ImportError:
+    import pkgutil
+    __path__ = pkgutil.extend_path(__path__, __name__)


Property changes on: lovely.buildouthttp/trunk/src/lovely/__init__.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: lovely.buildouthttp/trunk/src/lovely/buildouthttp/__init__.py
===================================================================
--- lovely.buildouthttp/trunk/src/lovely/buildouthttp/__init__.py	                        (rev 0)
+++ lovely.buildouthttp/trunk/src/lovely/buildouthttp/__init__.py	2007-06-14 09:35:13 UTC (rev 76678)
@@ -0,0 +1 @@
+#


Property changes on: lovely.buildouthttp/trunk/src/lovely/buildouthttp/__init__.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: lovely.buildouthttp/trunk/src/lovely/buildouthttp/buildouthttp.py
===================================================================
--- lovely.buildouthttp/trunk/src/lovely/buildouthttp/buildouthttp.py	                        (rev 0)
+++ lovely.buildouthttp/trunk/src/lovely/buildouthttp/buildouthttp.py	2007-06-14 09:35:13 UTC (rev 76678)
@@ -0,0 +1,36 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+
+import urllib2
+import os
+import sys
+import csv
+import logging
+log = logging.getLogger('lovely.buildouthttp')
+
+def install(buildout=None):
+    try:
+        pwdsf = file(os.path.join(os.path.expanduser('~'),
+                                  '.buildout',
+                                  '.httpauth'))
+    except IOError, e:
+        log.warn('Could not load authentication information: %s' % e)
+        return
+    reader = csv.reader(pwdsf)
+    auth_handler = urllib2.HTTPBasicAuthHandler()
+    for row in reader:
+        realm, uris, user, password = row
+        auth_handler.add_password(realm, uris, user, password)
+    opener = urllib2.build_opener(auth_handler)
+    urllib2.install_opener(opener)


Property changes on: lovely.buildouthttp/trunk/src/lovely/buildouthttp/buildouthttp.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native



More information about the Checkins mailing list