Commit 6e1932bd authored by Julien Muchembled's avatar Julien Muchembled

Revert to single-dist setup.py and use virtual dependencies instead

The only reason why we produced different eggs was because we may want to
install easily an admin node without caring about dependencies of neo.client.

Multi-dist setup.py contains hacks and was overkill for NEO.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2757 71dcc9de-d417-0410-9af5-da40c76e7ee4
git-svn-id: https://svn.erp5.org/repos/neo/trunk@2758 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent afa3a61e
graft tools
include neo.conf TODO TESTS.txt
include neo/client/component.xml # required for Python < 2.7
import pkg_resources
pkg_resources.declare_namespace(__name__)
import pkg_resources
pkg_resources.declare_namespace(__name__)
# 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
from setuptools import setup, find_packages
import os
description = 'Distributed, redundant and transactional storage for ZODB'
if 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)
extras_require = {
'client': ['ZODB3 >= 3.9'],
'storage-btree': ['ZODB3'],
'storage-mysqldb': ['MySQL-python'],
}
extras_require['tests'] = ['zope.testing', 'psutil',
'neoppod[%s]' % ', '.join(extras_require)]
setup_common = dict(
setup(
name = 'neoppod',
version = '1.0a1',
description = 'Distributed, redundant and transactional storage for ZODB',
author = 'NEOPPOD',
author_email = 'neo-dev@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:
# 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'],
packages = find_packages(),
py_modules = ['mock'],
entry_points = {
'console_scripts': [
# XXX: we'd like not to generate scripts for unwanted features
# (eg. we don't want neotestrunner if nothing depends on tests)
'neoadmin=neo.scripts.neoadmin: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': [
'neoctl=neo.scripts.neoctl:main',
'neomaster=neo.scripts.neomaster:main',
'neomigrate=neo.scripts.neomigrate:main',
'neostorage=neo.scripts.neostorage:main',
'neotestrunner=neo.scripts.runner:main',
],
},
# Raah!!! I wish I could write something like:
# install_requires = ['python>=2.5|ctypes'],
extras_require = extras_require,
package_data = {
'neo.client': [
'component.xml',
],
},
extra_files = ['neo/client/component.xml'], # required for Python < 2.7
)
setup(
name = 'neoctl',
description = description + ' - Controller part',
packages = ['neo', ('neo.neoctl', 'neo/neoctl')],
py_modules = ['neo.scripts.neoctl'],
entry_points = {
'console_scripts': [
'neoctl=neo.scripts.neoctl: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'],
zip_safe = True,
)
if setup_only in ('neotests', None):
if 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'),
)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment