diff options
author | Antoine Beaupré <anarcat@koumbit.org> | 2015-10-07 19:16:49 -0400 |
---|---|---|
committer | Antoine Beaupré <anarcat@koumbit.org> | 2015-10-07 19:29:27 -0400 |
commit | 28cbc6cbd1b3d70be284a69bc8049b435e101a81 (patch) | |
tree | 704fb55e556364f0db954638c2797f944ee6cdf8 /setup.py | |
parent | df20e512a002c1ac7d36b57929155b222671fc93 (diff) |
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.
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 28 |
1 files changed, 17 insertions, 11 deletions
@@ -10,6 +10,9 @@ if my_python < min_python: 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 @@ except ImportError: 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 @@ possible_lz4_prefixes = ['/usr', '/usr/local', '/usr/local/opt/lz4', '/usr/local 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,18 +118,20 @@ with open('README.rst', 'r') as fd: 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'): - ext_modules.append(Extension('borg.platform_linux', [platform_linux_source], libraries=['acl'])) -elif sys.platform.startswith('freebsd'): - ext_modules.append(Extension('borg.platform_freebsd', [platform_freebsd_source])) -elif sys.platform == 'darwin': - ext_modules.append(Extension('borg.platform_darwin', [platform_darwin_source])) + if sys.platform.startswith('linux'): + ext_modules.append(Extension('borg.platform_linux', [platform_linux_source], libraries=['acl'])) + elif sys.platform.startswith('freebsd'): + ext_modules.append(Extension('borg.platform_freebsd', [platform_freebsd_source])) + elif sys.platform == 'darwin': + ext_modules.append(Extension('borg.platform_darwin', [platform_darwin_source])) setup( name='borgbackup', |