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 from setuptools import setup, find_packages
# several binary packages from a single source one. This setup.py import os
# 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
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)
setup_common = dict( 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(
name = 'neoppod',
version = '1.0a1', version = '1.0a1',
description = 'Distributed, redundant and transactional storage for ZODB',
author = 'NEOPPOD', author = 'NEOPPOD',
author_email = 'neo-dev@erp5.org', author_email = 'neo-dev@erp5.org',
url = 'http://www.neoppod.org/', url = 'http://www.neoppod.org/',
license = 'GPL 2+', license = 'GPL 2+',
install_requires = ['neoppod'], packages = find_packages(),
namespace_packages = ['neo', 'neo.scripts'], py_modules = ['mock'],
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'],
entry_points = { entry_points = {
'console_scripts': [ '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', 'neoadmin=neo.scripts.neoadmin:main',
], 'neoctl=neo.scripts.neoctl:main',
}, 'neomaster=neo.scripts.neomaster: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': [
'neomigrate=neo.scripts.neomigrate: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 = { package_data = {
'neo.client': [ 'neo.client': [
'component.xml', 'component.xml',
], ],
}, },
extra_files = ['neo/client/component.xml'], # required for Python < 2.7 zip_safe = True,
)
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'],
) )
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