Embrace environment markers (a.k.a. PEP 508 compliance)!

Failure to use environment markers means the dependencies are
unconditionally added at build time based on the host instead of being
always present and evaluated at runtime on the target; e.g. wheels have
the wrong information.

Also use python_requires. This teaches pip how to natively comprehend
when the current version of python is not supported by borg.

Returns errors in the format:
borgbackup requires Python '>=3.5' but the running Python is $oldver
This commit is contained in:
Eli Schwartz 2018-06-11 22:29:16 -04:00
parent 511371fcd8
commit b5d22b5fba
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
1 changed files with 8 additions and 16 deletions

View File

@ -38,13 +38,6 @@ prefer_system_libzstd = True
# True: use the shared libb2 from the system, False: use the bundled blake2 code
prefer_system_libb2 = True
min_python = (3, 5)
my_python = sys.version_info
if my_python < min_python:
print("Borg requires Python %d.%d or later" % min_python)
sys.exit(1)
cpu_threads = multiprocessing.cpu_count() if multiprocessing else 1
# Are we building on ReadTheDocs?
@ -77,17 +70,15 @@ extras_require = {
# llfuse 1.2 (tested shortly, looks ok), needs FUSE version >= 2.8.0
# llfuse 1.3 (tested shortly, looks ok), needs FUSE version >= 2.8.0
# llfuse 2.0 will break API
'fuse': ['llfuse<2.0', ],
'fuse': [
'llfuse<2.0',
# llfuse was frequently broken / did not build on freebsd
# llfuse 0.41.1, 1.1 are ok
'llfuse !=0.42.*, !=0.43, !=1.0; platform_system == "FreeBSD"',
'llfuse >=1.3.4; python_version >="3.7"',
],
}
if sys.platform.startswith('freebsd'):
# llfuse was frequently broken / did not build on freebsd
# llfuse 0.41.1, 1.1 are ok
extras_require['fuse'] = ['llfuse <2.0, !=0.42.*, !=0.43, !=1.0', ]
if my_python >= (3, 7):
extras_require['fuse'][0] += ', >=1.3.4'
compress_source = 'src/borg/compress.pyx'
crypto_ll_source = 'src/borg/crypto/low_level.pyx'
crypto_helpers = 'src/borg/crypto/_crypto_helpers.c'
@ -844,4 +835,5 @@ setup(
setup_requires=['setuptools_scm>=1.7'],
install_requires=install_requires,
extras_require=extras_require,
python_requires='>=3.5',
)