1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-23 00:07:38 +00:00

fix build on RTFD

first off, this required ticking the `Install your project inside a
virtualenv using setup.py install` box in the advanced config.

then, i had to disable all the C extensions build and disable some
checks, based on whether we are running on RTD or not.

still missing: usage builds and possibly other stuff that is in our
Makefile and not in setup.py.
This commit is contained in:
Antoine Beaupré 2015-10-07 19:16:49 -04:00
parent df20e512a0
commit 28cbc6cbd1

View file

@ -10,6 +10,9 @@
print("Borg requires Python %d.%d or later" % min_python)
sys.exit(1)
# Are we building on ReadTheDocs?
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
# msgpack pure python data corruption was fixed in 0.4.6.
# Also, we might use some rather recent API features.
install_requires=['msgpack-python>=0.4.6', ]
@ -64,7 +67,7 @@ def __init__(self, *args, **kwargs):
from distutils.command.build_ext import build_ext
if not all(os.path.exists(path) for path in [
compress_source, crypto_source, chunker_source, hashindex_source,
platform_linux_source, platform_freebsd_source]):
platform_linux_source, platform_freebsd_source]) and not on_rtd:
raise ImportError('The GIT version of Borg needs Cython. Install Cython or use a released version.')
@ -103,10 +106,11 @@ def detect_lz4(prefixes):
if os.environ.get('BORG_LZ4_PREFIX'):
possible_openssl_prefixes.insert(0, os.environ.get('BORG_LZ4_PREFIX'))
lz4_prefix = detect_lz4(possible_lz4_prefixes)
if not lz4_prefix:
if lz4_prefix:
include_dirs.append(os.path.join(lz4_prefix, 'include'))
library_dirs.append(os.path.join(lz4_prefix, 'lib'))
elif not on_rtd:
raise Exception('Unable to find LZ4 headers. (Looked here: {})'.format(', '.join(possible_lz4_prefixes)))
include_dirs.append(os.path.join(lz4_prefix, 'include'))
library_dirs.append(os.path.join(lz4_prefix, 'lib'))
with open('README.rst', 'r') as fd:
@ -114,17 +118,19 @@ def detect_lz4(prefixes):
cmdclass = {'build_ext': build_ext, 'sdist': Sdist}
ext_modules = [
ext_modules = []
if not on_rtd:
ext_modules += [
Extension('borg.compress', [compress_source], libraries=['lz4'], include_dirs=include_dirs, library_dirs=library_dirs),
Extension('borg.crypto', [crypto_source], libraries=['crypto'], include_dirs=include_dirs, library_dirs=library_dirs),
Extension('borg.chunker', [chunker_source]),
Extension('borg.hashindex', [hashindex_source])
]
if sys.platform.startswith('linux'):
if sys.platform.startswith('linux'):
ext_modules.append(Extension('borg.platform_linux', [platform_linux_source], libraries=['acl']))
elif sys.platform.startswith('freebsd'):
elif sys.platform.startswith('freebsd'):
ext_modules.append(Extension('borg.platform_freebsd', [platform_freebsd_source]))
elif sys.platform == 'darwin':
elif sys.platform == 'darwin':
ext_modules.append(Extension('borg.platform_darwin', [platform_darwin_source]))
setup(