Commit c7288310 authored by Kirill Smelkov's avatar Kirill Smelkov

[ZODB3] Provide stub ZODB/persistent/BTrees/ZEO eggs for forward-compatibility with ZODB4 and ZODB5

This depend-only eggs have to be installed manually for
forward-compatibility with ZODB4 and ZODB5, so that e.g. installing
any egg that depends on 'ZODB' (not 'ZODB3') will not pull in ZODB5.
Example of those eggs are zodbtools, zodburi, ...

Unfortunately there is no way for this to work automatically - for
example there is 'provides' and 'provides-dist' setup keywords and
corresponding metadata, but no Python package manager actually supports
that:

    https://packaging.python.org/specifications/core-metadata/#rarely-used-fields
    https://www.python.org/dev/peps/pep-0314/#provides-multiple-use
    https://www.python.org/dev/peps/pep-0345/#provides-dist-multiple

    https://github.com/pypa/packaging-problems/issues/154   (obsoletes/provides not supported)
parent a910fd44
../ZODB/setup.py
\ No newline at end of file
../ZODB/setup.py
\ No newline at end of file
# Setup for stub ZODB/BTrees/persistent/ZEO eggs to depend on ZODB3.
# These are stub packages fro ZODB3 to be forward compatible with ZODB4/5.
from setuptools import setup
from os.path import basename, dirname, join
import re
# find our name (ZODB/BTrees/persistent/ZEO)
NAME = basename(dirname(__file__)) # .../ZODB45-compat/ZODB/setup.py -> ZODB
# find out ZODB3 version
# grep searches text for pattern.
# return re.Match object or raises if pattern was not found.
def grep1(pattern, text):
rex = re.compile(pattern, re.MULTILINE)
m = rex.search(text)
if m is None:
raise RuntimeError('%r not found' % pattern)
return m
# read file content
def readfile(path):
with open(path, 'r') as f:
return f.read()
_ = readfile(join(dirname(__file__), '../../setup.py'))
_ = grep1('^VERSION = "(.*)"$', _)
VERSION = _.group(1)
# setup stub ZODB/BTrees/... egg that just depends on ZODB3
setup(name=NAME,
version=VERSION,
packages = [],
install_requires = ['ZODB3 == %s' % VERSION],
)
../ZODB/setup.py
\ No newline at end of file
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