[Neo-report] r2750 jm - in /trunk: ./ buildout/ eggs/ neo/ neo/client/

nobody at svn.erp5.org nobody at svn.erp5.org
Fri May 20 23:39:41 CEST 2011


Author: jm
Date: Fri May 20 23:39:40 2011
New Revision: 2750

Log:
Full review of packaging, with multi-eggs setup.py

- multi-eggs setup.py because we really don't want to split the repository
  in several ones
- move 'components.xml' since namespace packages should not contain anything
- workaround python-mock.sf.net because not eggified:
  automatically get a copy of mock.py (license: BSD) when setting up 'neotests'

Added:
    trunk/neo/client/component.xml
      - copied, changed from r2749, trunk/neo/component.xml
Removed:
    trunk/MANIFEST.in
    trunk/buildout/
    trunk/eggs/
    trunk/neo/component.xml
    trunk/setup_admin.py
    trunk/setup_client.py
    trunk/setup_common.py
    trunk/setup_ctl.py
    trunk/setup_master.py
    trunk/setup_storage.py
    trunk/setup_tests.py
Modified:
    trunk/README
    trunk/setup.py

Removed: trunk/MANIFEST.in
==============================================================================
--- trunk/MANIFEST.in [iso-8859-1] (original)
+++ trunk/MANIFEST.in (removed)
@@ -1,3 +0,0 @@
-graft tools
-include neoadmin neoctl neomaster neomigrate neostorage neo.conf README TODO
-global-exclude *~

Modified: trunk/README
==============================================================================
--- trunk/README [iso-8859-1] (original)
+++ trunk/README [iso-8859-1] Fri May 20 23:39:40 2011
@@ -9,6 +9,8 @@ Requirements
 
     - For python 2.4: ctypes http://python.net/crew/theller/ctypes/
       (packaged with later python versions)
+      Note that setup.py does not define any dependency to 'ctypes' so you will
+      have to install it explicitely.
 
     - MySQLdb http://sourceforge.net/projects/mysql-python
 
@@ -71,7 +73,7 @@ How to use
       replacing its filestorage subsection by a NEOStorage one.
       It should look like :
 
-      %import neo
+      %import neo.client
       <zodb_db main>
           # Main FileStorage database
           <NEOStorage>

Copied: trunk/neo/client/component.xml (from r2749, trunk/neo/component.xml)
==============================================================================
    (empty)

Removed: trunk/neo/component.xml
==============================================================================
--- trunk/neo/component.xml [iso-8859-1] (original)
+++ trunk/neo/component.xml (removed)
@@ -1,29 +0,0 @@
-<component prefix="neo.client.config">
-  <sectiontype name="NeoStorage" datatype=".NeoStorage"
-               implements="ZODB.storage">
-     <description>
-       A scalable storage for Zope
-     </description>
-     <key name="master_nodes" required="yes">
-      <description>
-       Give the list of the master node like ip:port ip:port...
-      </description>
-     </key>
-     <key name="name" required="yes">
-      <description>
-       Give the name of the cluster
-      </description>
-     </key>
-     <key name="connector" required="no">
-      <description>
-       Give the name of the connector used at low-level
-      </description>
-     </key>
-     <key name="compress" required="no" default="true" datatype="boolean">
-      <description>
-      true: enable automatic data compression (compression is only used when compressed size is smaller).
-      false: disable data compression.
-      </description>
-     </key>
-  </sectiontype>
-</component>

Modified: trunk/setup.py
==============================================================================
--- trunk/setup.py [iso-8859-1] (original)
+++ trunk/setup.py [iso-8859-1] Fri May 20 23:39:40 2011
@@ -1,35 +1,177 @@
-from setuptools import setup, find_packages
+# WKRD: Official Python packaging and buildout are not designed to build
+#       several binary packages from a single source one. This setup.py
+#       contains several hacks to work around this horrible limitation, and
+#       make it possible to develop several eggs in the same tree/repository:
+#       - in development mode, it behaves somehow like a mono-package
+#       - otherwise, sdist/bdist commands produces several packages
 
-setup(name='neo',
-    version='0.1.0',
-    description='Distributed, redundant and transactional storage for ZODB',
-    author='NEOPPOD',
-    author_email='neo-dev at erp5.org',
-    url='http://www.neoppod.org/',
-    license="GPL 2",
-    packages=find_packages(),
-    package_dir={'neo': 'neo'},
-    install_requires=[
-        'ZODB3',
-    ],
-    extras_require={
-        'storage': ['MySQL-python'],
-        'test': ['MySQL-python', 'mock'],
-    },
-    entry_points={
+description = 'Distributed, redundant and transactional storage for ZODB'
+
+setup_common = dict(
+    version = '1.0a1',
+    author = 'NEOPPOD',
+    author_email = 'neo-dev at erp5.org',
+    url = 'http://www.neoppod.org/',
+    license = 'GPL 2+',
+    install_requires = ['neoppod'],
+    namespace_packages = ['neo', 'neo.scripts'],
+    zip_safe = True,
+)
+
+import os, sys
+from distutils.filelist import findall
+
+try:
+    setup_only, = [l[5:].strip() for l in open('PKG-INFO') if l[:5] == 'Name:']
+except IOError:
+    setup_only = None
+
+def setup(name, packages=(), extra_files=(), _done=[], **kw):
+    if setup_only and setup_only != name or \
+       _done and ('--help' in sys.argv or '--help-commands' in sys.argv):
+        return
+    from distutils.command.build import build
+    from setuptools import find_packages, setup
+    from setuptools.command import egg_info, develop
+    kw['packages'] = sum((isinstance(p, basestring) and [p] or
+        list(p[:1]) + [p[0] + '.' + x for x in find_packages(*p[1:])]
+        for p in packages), [])
+    # monkey-patch to build package in different folders
+    build_initialize_options = build.initialize_options
+    def initialize_options(self):
+        build_initialize_options(self)
+        self.build_base = os.path.join(self.build_base, name)
+    # per-package manifest, instead of walking files under revision control
+    walk_revctrl = egg_info.walk_revctrl
+    # create only 1 egg-link for buildout
+    develop_finalize_options = develop.develop.finalize_options
+    def finalize_options(self):
+        develop_finalize_options(self)
+        self.egg_link = os.devnull
+    try:
+        build.initialize_options = initialize_options
+        egg_info.walk_revctrl = lambda *args, **kw: extra_files
+        if _done:
+            develop.develop.finalize_options = finalize_options
+        setup(name = name, **dict(setup_common, **kw))
+    finally:
+        develop.develop.finalize_options = develop_finalize_options
+        build.initialize_options = build_initialize_options
+        egg_info.walk_revctrl = walk_revctrl
+    _done.append(name)
+
+setup(
+    name = 'neoppod',
+    description = description + ' - Common part',
+    packages = ['neo', ('neo.lib', 'neo/lib')],
+    # Raah!!! I wish I could write something like (for 'neoppod'):
+    #  install_requires = ['python>=2.5|ctypes']
+    install_requires = (),
+    namespace_packages = ['neo'],
+    extra_files = ['TODO'],
+)
+
+setup(
+    name = 'neoadmin',
+    description = description + ' - Admin part',
+    packages = ['neo', ('neo.admin', 'neo/admin')],
+    py_modules = ['neo.scripts.neoadmin'],
+    entry_points = {
         'console_scripts': [
             'neoadmin=neo.scripts.neoadmin:main',
-            'neoctl=neo.scripts.neoctl:main',
-            'neomaster=neo.scripts.neomaster:main',
-            'neomigrate=neo.scripts.neomigrate:main',
-            'neostorage=neo.scripts.neostorage:main',
+        ],
+    },
+    extra_files = ['neo.conf'],
+)
+
+setup(
+    name = 'neoclient',
+    description = description + ' - Client part',
+    packages = ['neo', ('neo.client', 'neo/client')],
+    install_requires = ['neoppod', 'ZODB3 >= 3.9'],
+    py_modules = ['neo.scripts.neomigrate'],
+    entry_points = {
+        'console_scripts': [
+            'neoadmin=neo.scripts.neomigrate:main',
         ],
     },
     package_data = {
-        'neo': [
+        'neo.client': [
             'component.xml',
         ],
     },
     zip_safe=False,
 )
 
+setup(
+    name = 'neoctl',
+    description = description + ' - Controller part',
+    packages = ['neo', ('neo.neoctl', 'neo/neoctl')],
+    py_modules = ['neo.scripts.neomigrate'],
+    entry_points = {
+        'console_scripts': [
+            'neoctl=neo.scripts.neomigrate:main',
+        ],
+    },
+)
+
+setup(
+    name = 'neomaster',
+    description = description + ' - Master part',
+    packages = ['neo', ('neo.master', 'neo/master')],
+    py_modules = ['neo.scripts.neomaster'],
+    entry_points = {
+        'console_scripts': [
+            'neomaster=neo.scripts.neomaster:main',
+        ],
+    },
+    extra_files = ['neo.conf'],
+)
+
+setup(
+    name = 'neostorage',
+    description = description + ' - Storage part',
+    packages = ['neo', ('neo.storage', 'neo/storage')],
+    py_modules = ['neo.scripts.neostorage'],
+    entry_points = {
+        'console_scripts': [
+            'neostorage=neo.scripts.neostorage:main',
+        ],
+    },
+    extras_require = {
+        'btree': ['ZODB3'],
+        'mysqldb': ['MySQL-python'],
+    },
+    extra_files = ['neo.conf'],
+)
+
+if setup_only in ('neotests', None) and not os.path.exists('mock.py'):
+    import cStringIO, md5, urllib, zipfile
+    mock_py = zipfile.ZipFile(cStringIO.StringIO(urllib.urlopen(
+      'http://downloads.sf.net/sourceforge/python-mock/pythonmock-0.1.0.zip'
+      ).read())).read('mock.py')
+    if md5.md5(mock_py).hexdigest() != '79f42f390678e5195d9ce4ae43bd18ec':
+        raise EnvironmentError("MD5 checksum mismatch downloading 'mock.py'")
+    open('mock.py', 'w').write(mock_py)
+
+setup(
+    name = 'neotests',
+    description = description + ' - Testing part',
+    packages = ['neo', ('neo.tests', 'neo/tests')],
+    install_requires = [
+        'neoadmin',
+        'neoclient',
+        'neoctl',
+        'neomaster',
+        'neostorage[btree, mysqldb]',
+        'psutil',
+        'zope.testing',
+    ],
+    py_modules = ['mock', 'neo.scripts.runner'],
+    entry_points = {
+        'console_scripts': [
+            'neotestrunner=neo.scripts.runner:main',
+        ],
+    },
+    extra_files = ['TESTS.txt'] + findall('tools'),
+)

Removed: trunk/setup_admin.py
==============================================================================
--- trunk/setup_admin.py [iso-8859-1] (original)
+++ trunk/setup_admin.py (removed)
@@ -1,41 +0,0 @@
-from setuptools import setup, find_packages
-
-setup(name='neoadmin',
-
-    version=
-      '0.1.0',
-    description=
-      'Distributed, redundant and transactional storage for ZODB-Admin part',
-    author=
-      'NEOPPOD',
-    author_email=
-      'neo-dev at erp5.org',
-    url=
-      'http://www.neoppod.org/',
-    license=
-      "GPL 2",
-
-    py_modules=[
-      'neo.scripts.neoadmin'
-      ],
-
-    packages=['neo.admin'],
-
-    package_dir={
-      'neo':'neo',
-    },
-
-    namespace_packages=['neo','neo.scripts'],
-
-    install_requires=[
-      'neo',
-    ],
-
-    entry_points = {
-        'console_scripts': [
-          'neoadmin=neo.scripts.neoadmin:main',
-        ],
-    },
-    zip_safe=False,
-)
-

Removed: trunk/setup_client.py
==============================================================================
--- trunk/setup_client.py [iso-8859-1] (original)
+++ trunk/setup_client.py (removed)
@@ -1,37 +0,0 @@
-from setuptools import setup, find_packages
-
-setup(name='neoclient',
-
-    version=
-      '0.1.0',
-    description=
-      'Distributed, redundant and transactional storage for ZODB-Admin part',
-    author=
-      'NEOPPOD',
-    author_email=
-      'neo-dev at erp5.org',
-    url=
-      'http://www.neoppod.org/',
-    license=
-      "GPL 2",
-
-    py_modules=[
-     'neo.scripts.neomigrate',
-      ],
-
-    packages=['neo.client','neo.client.handlers'],
-
-    package_dir={
-      'neo':'neo',
-    },
-
-    namespace_packages=['neo','neo.client'],
-
-    install_requires=[
-      'neo',
-      'ZODB3',
-    ],
-
-    zip_safe=False,
-)
-

Removed: trunk/setup_common.py
==============================================================================
--- trunk/setup_common.py [iso-8859-1] (original)
+++ trunk/setup_common.py (removed)
@@ -1,24 +0,0 @@
-from setuptools import setup, find_packages
-
-setup(name='neo',
-    version='0.1.0',
-    description='Distributed, redundant and transactional storage for ZODB- Common part',
-    author='NEOPPOD',
-    author_email='neo-dev at erp5.org',
-    url='http://www.neoppod.org/',
-    license="GPL 2",
-
-    packages=['neo.lib'],
-    package_dir={
-            'neo':'neo',
-    },
-    namespace_packages=['neo'],
-
-    package_data = {
-        'neo': [
-            'component.xml',
-        ],
-    },
-    zip_safe=False,
-)
-

Removed: trunk/setup_ctl.py
==============================================================================
--- trunk/setup_ctl.py [iso-8859-1] (original)
+++ trunk/setup_ctl.py (removed)
@@ -1,41 +0,0 @@
-from setuptools import setup, find_packages
-
-setup(name='neoctl',
-
-    version=
-      '0.1.0',
-    description=
-      'Distributed, redundant and transactional storage for ZODB-Admin part',
-    author=
-      'NEOPPOD',
-    author_email=
-      'neo-dev at erp5.org',
-    url=
-      'http://www.neoppod.org/',
-    license=
-      "GPL 2",
-
-    py_modules=[
-      'neo.scripts.neoctl'
-      ],
-
-    packages=['neo.neoctl'],
-
-    package_dir={
-      'neo':'neo',
-    },
-
-    namespace_packages=['neo','neo.scripts'],
-
-    install_requires=[
-      'neo',
-    ],
-
-    entry_points = {
-        'console_scripts': [
-          'neoctl=neo.scripts.neoctl:main',
-        ],
-    },
-    zip_safe=False,
-)
-

Removed: trunk/setup_master.py
==============================================================================
--- trunk/setup_master.py [iso-8859-1] (original)
+++ trunk/setup_master.py (removed)
@@ -1,41 +0,0 @@
-from setuptools import setup, find_packages
-
-setup(name='neomaster',
-
-    version=
-      '0.1.0',
-    description=
-      'Distributed, redundant and transactional storage for ZODB-Admin part',
-    author=
-      'NEOPPOD',
-    author_email=
-      'neo-dev at erp5.org',
-    url=
-      'http://www.neoppod.org/',
-    license=
-      "GPL 2",
-
-    py_modules=[
-      'neo.scripts.neomaster',
-      ],
-
-    packages=['neo.master','neo.master.handlers'],
-
-    package_dir={
-      'neo':'neo',
-    },
-
-    namespace_packages=['neo','neo.scripts'],
-
-    install_requires=[
-      'neo',
-    ],
-
-    entry_points = {
-        'console_scripts': [
-          'neomaster=neo.scripts.neomaster:main',
-        ],
-    },
-    zip_safe=False,
-)
-

Removed: trunk/setup_storage.py
==============================================================================
--- trunk/setup_storage.py [iso-8859-1] (original)
+++ trunk/setup_storage.py (removed)
@@ -1,43 +0,0 @@
-from setuptools import setup, find_packages
-
-setup(name='neostorage',
-
-    version=
-      '0.1.0',
-    description=
-      'Distributed, redundant and transactional storage for ZODB-Admin part',
-    author=
-      'NEOPPOD',
-    author_email=
-      'neo-dev at erp5.org',
-    url=
-      'http://www.neoppod.org/',
-    license=
-      "GPL 2",
-
-    py_modules=[
-      'neo.protocol',
-      'neo.scripts.neostorage'
-      ],
-
-    packages=['neo.storage','neo.storage.database','neo.storage.handlers'],
-
-    package_dir={
-      'neo':'neo',
-    },
-
-    namespace_packages=['neo','neo.scripts'],
-
-    install_requires=[
-      'neo',
-      'MySQL-python',
-    ],
-
-    entry_points = {
-        'console_scripts': [
-          'neostorage=neo.scripts.neostorage:main',
-        ],
-    },
-    zip_safe=False,
-)
-

Removed: trunk/setup_tests.py
==============================================================================
--- trunk/setup_tests.py [iso-8859-1] (original)
+++ trunk/setup_tests.py (removed)
@@ -1,47 +0,0 @@
-from setuptools import setup, find_packages
-
-setup(name='neotests',
-
-    version=
-      '0.1.0',
-    description=
-      'Distributed, redundant and transactional storage for ZODB-Admin part',
-    author=
-      'NEOPPOD',
-    author_email=
-      'neo-dev at erp5.org',
-    url=
-      'http://www.neoppod.org/',
-    license=
-      "GPL 2",
-
-    py_modules=[
-      'neo.scripts.runner'
-      ],
-
-    packages=['neo.tests','neo.tests.functional','neo.tests.master','neo.tests.storage','neo.tests.zodb','neo.tests.client'],
-
-    package_dir={
-      'neo':'neo',
-    },
-
-    namespace_packages=['neo','neo.scripts'],
-
-    install_requires=[
-      'neo',
-      'neoadmin',
-      'neostorage',
-      'neoclient',
-      'neomaster',
-      'neoctl',
-      'mock'
-    ],
-
-    entry_points = {
-        'console_scripts': [
-                'neotestrunner=neo.scripts.runner:main',
-        ],
-    },
-    zip_safe=False,
-)
-




More information about the Neo-report mailing list