|
@@ -20,68 +20,16 @@ except ImportError:
|
|
|
cythonize = None
|
|
|
|
|
|
sys.path += [os.path.dirname(__file__)]
|
|
|
-import setup_checksums
|
|
|
-import setup_compress
|
|
|
-import setup_crypto
|
|
|
import setup_docs
|
|
|
|
|
|
is_win32 = sys.platform.startswith('win32')
|
|
|
|
|
|
-# How the build process finds the system libs:
|
|
|
-#
|
|
|
-# 1. if BORG_LIBXXX_PREFIX is set, it will use headers and libs from there.
|
|
|
-# 2. if not and pkg-config can locate the lib, the lib located by
|
|
|
-# pkg-config will be used. We use the pkg-config tool via the pkgconfig
|
|
|
-# python package, which must be installed before invoking setup.py.
|
|
|
-# if pkgconfig is not installed, this step is skipped.
|
|
|
-# 3. otherwise raise a fatal error.
|
|
|
-
|
|
|
-# needed: >=1.1.1 (or compatible)
|
|
|
-system_prefix_openssl = os.environ.get('BORG_OPENSSL_PREFIX')
|
|
|
-
|
|
|
-# needed: lz4 (>= 1.7.0 / r129)
|
|
|
-system_prefix_liblz4 = os.environ.get('BORG_LIBLZ4_PREFIX')
|
|
|
-
|
|
|
-# needed: zstd (>= 1.3.0)
|
|
|
-system_prefix_libzstd = os.environ.get('BORG_LIBZSTD_PREFIX')
|
|
|
-
|
|
|
-# needed: xxhash (>= 0.8.1)
|
|
|
-system_prefix_libxxhash = os.environ.get('BORG_LIBXXHASH_PREFIX')
|
|
|
-
|
|
|
-# needed: deflate (>= 1.5)
|
|
|
-system_prefix_libdeflate = os.environ.get('BORG_LIBDEFLATE_PREFIX')
|
|
|
-
|
|
|
# Number of threads to use for cythonize, not used on windows
|
|
|
cpu_threads = multiprocessing.cpu_count() if multiprocessing and multiprocessing.get_start_method() != 'spawn' else None
|
|
|
|
|
|
# Are we building on ReadTheDocs?
|
|
|
on_rtd = os.environ.get('READTHEDOCS')
|
|
|
|
|
|
-install_requires = [
|
|
|
- # we are rather picky about msgpack versions, because a good working msgpack is
|
|
|
- # very important for borg, see: https://github.com/borgbackup/borg/issues/3753
|
|
|
- 'msgpack >=1.0.3, <=1.0.3',
|
|
|
- # Please note:
|
|
|
- # using any other version is not supported by borg development and
|
|
|
- # any feedback related to issues caused by this will be ignored.
|
|
|
- 'packaging',
|
|
|
- 'argon2-cffi',
|
|
|
-]
|
|
|
-
|
|
|
-# note for package maintainers: if you package borgbackup for distribution,
|
|
|
-# please (if available) add pyfuse3 (preferably) or llfuse (not maintained any more)
|
|
|
-# as a *requirement*. "borg mount" needs one of them to work.
|
|
|
-# if neither is available, do not require it, most of borgbackup will work.
|
|
|
-extras_require = {
|
|
|
- 'llfuse': [
|
|
|
- 'llfuse >= 1.3.8',
|
|
|
- ],
|
|
|
- 'pyfuse3': [
|
|
|
- 'pyfuse3 >= 3.1.1',
|
|
|
- ],
|
|
|
- 'nofuse': [],
|
|
|
-}
|
|
|
-
|
|
|
# Extra cflags for all extensions, usually just warnings we want to explicitly enable
|
|
|
cflags = [
|
|
|
'-Wall',
|
|
@@ -165,6 +113,16 @@ cmdclass = {
|
|
|
'clean2': Clean,
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+# How the build process finds the system libs:
|
|
|
+#
|
|
|
+# 1. if BORG_LIBXXX_PREFIX is set, it will use headers and libs from there.
|
|
|
+# 2. if not and pkg-config can locate the lib, the lib located by
|
|
|
+# pkg-config will be used. We use the pkg-config tool via the pkgconfig
|
|
|
+# python package, which must be installed before invoking setup.py.
|
|
|
+# if pkgconfig is not installed, this step is skipped.
|
|
|
+# 3. otherwise raise a fatal error.
|
|
|
+
|
|
|
ext_modules = []
|
|
|
if not on_rtd:
|
|
|
|
|
@@ -182,23 +140,37 @@ if not on_rtd:
|
|
|
print('Warning: can not import pkgconfig python package.')
|
|
|
pc = None
|
|
|
|
|
|
+ def lib_ext_kwargs(pc, prefix_env_var, lib_name, lib_pkg_name, pc_version):
|
|
|
+ system_prefix = os.environ.get(prefix_env_var)
|
|
|
+ if system_prefix:
|
|
|
+ print(f'Detected and preferring {lib_pkg_name} [via {prefix_env_var}]')
|
|
|
+ return dict(include_dirs=[os.path.join(system_prefix, 'include')],
|
|
|
+ library_dirs=[os.path.join(system_prefix, 'lib')],
|
|
|
+ libraries=[lib_name])
|
|
|
+
|
|
|
+ if pc and pc.installed(lib_pkg_name, pc_version):
|
|
|
+ print(f'Detected and preferring {lib_pkg_name} [via pkg-config]')
|
|
|
+ return pc.parse(lib_pkg_name)
|
|
|
+ raise Exception(f'Could not find {lib_name} lib/headers, please set {prefix_env_var}')
|
|
|
+
|
|
|
+
|
|
|
crypto_ext_kwargs = members_appended(
|
|
|
dict(sources=[crypto_ll_source, crypto_helpers]),
|
|
|
- setup_crypto.crypto_ext_kwargs(pc, system_prefix_openssl),
|
|
|
+ lib_ext_kwargs(pc, 'BORG_OPENSSL_PREFIX', 'crypto', 'libcrypto', '>=1.1.1'),
|
|
|
dict(extra_compile_args=cflags),
|
|
|
)
|
|
|
|
|
|
compress_ext_kwargs = members_appended(
|
|
|
dict(sources=[compress_source]),
|
|
|
- setup_compress.lz4_ext_kwargs(pc, system_prefix_liblz4),
|
|
|
- setup_compress.zstd_ext_kwargs(pc, system_prefix_libzstd),
|
|
|
+ lib_ext_kwargs(pc, 'BORG_LIBLZ4_PREFIX', 'lz4', 'liblz4', '>= 1.7.0'),
|
|
|
+ lib_ext_kwargs(pc, 'BORG_LIBZSTD_PREFIX', 'zstd', 'libzstd', '>= 1.3.0'),
|
|
|
dict(extra_compile_args=cflags),
|
|
|
)
|
|
|
|
|
|
checksums_ext_kwargs = members_appended(
|
|
|
dict(sources=[checksums_source]),
|
|
|
- setup_checksums.xxhash_ext_kwargs(pc, system_prefix_libxxhash),
|
|
|
- setup_checksums.deflate_ext_kwargs(pc, system_prefix_libdeflate),
|
|
|
+ lib_ext_kwargs(pc, 'BORG_LIBXXHASH_PREFIX', 'xxhash', 'libxxhash', '>= 0.8.1'),
|
|
|
+ lib_ext_kwargs(pc, 'BORG_LIBDEFLATE_PREFIX', 'deflate', 'libdeflate', '>= 1.5'),
|
|
|
dict(extra_compile_args=cflags),
|
|
|
)
|
|
|
|
|
@@ -253,54 +225,9 @@ if not on_rtd:
|
|
|
|
|
|
|
|
|
setup(
|
|
|
- name='borgbackup',
|
|
|
use_scm_version={
|
|
|
'write_to': 'src/borg/_version.py',
|
|
|
},
|
|
|
- author='The Borg Collective (see AUTHORS file)',
|
|
|
- author_email='borgbackup@python.org',
|
|
|
- url='https://borgbackup.readthedocs.io/',
|
|
|
- description='Deduplicated, encrypted, authenticated and compressed backups',
|
|
|
- long_description=setup_docs.long_desc_from_readme(),
|
|
|
- license='BSD',
|
|
|
- platforms=['Linux', 'MacOS X', 'FreeBSD', 'OpenBSD', 'NetBSD', ],
|
|
|
- classifiers=[
|
|
|
- 'Development Status :: 4 - Beta',
|
|
|
- 'Environment :: Console',
|
|
|
- 'Intended Audience :: System Administrators',
|
|
|
- 'License :: OSI Approved :: BSD License',
|
|
|
- 'Operating System :: POSIX :: BSD :: FreeBSD',
|
|
|
- 'Operating System :: POSIX :: BSD :: OpenBSD',
|
|
|
- 'Operating System :: POSIX :: BSD :: NetBSD',
|
|
|
- 'Operating System :: MacOS :: MacOS X',
|
|
|
- 'Operating System :: POSIX :: Linux',
|
|
|
- 'Programming Language :: Python',
|
|
|
- 'Programming Language :: Python :: 3',
|
|
|
- 'Programming Language :: Python :: 3.9',
|
|
|
- 'Programming Language :: Python :: 3.10',
|
|
|
- 'Topic :: Security :: Cryptography',
|
|
|
- 'Topic :: System :: Archiving :: Backup',
|
|
|
- ],
|
|
|
- packages=find_packages('src'),
|
|
|
- package_dir={'': 'src'},
|
|
|
- zip_safe=False,
|
|
|
- entry_points={
|
|
|
- 'console_scripts': [
|
|
|
- 'borg = borg.archiver:main',
|
|
|
- 'borgfs = borg.archiver:main',
|
|
|
- ]
|
|
|
- },
|
|
|
- # See also the MANIFEST.in file.
|
|
|
- # We want to install all the files in the package directories...
|
|
|
- include_package_data=True,
|
|
|
- # ...except the source files which have been compiled (C extensions):
|
|
|
- exclude_package_data={
|
|
|
- '': ['*.c', '*.h', '*.pyx', ],
|
|
|
- },
|
|
|
cmdclass=cmdclass,
|
|
|
ext_modules=ext_modules,
|
|
|
- setup_requires=['setuptools_scm>=1.7'],
|
|
|
- install_requires=install_requires,
|
|
|
- extras_require=extras_require,
|
|
|
- python_requires='>=3.9',
|
|
|
)
|