summaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
authorManu <manu@snapdragon.cc>2022-03-24 08:41:34 +0400
committerManu <manu@snapdragon.cc>2022-03-24 08:41:34 +0400
commit710d76e5c2d0437faec842a5585126feb689a819 (patch)
tree75a8eacd00742a814948974bf60e9dd2ca8b77c4 /setup.py
parentf36a0fc6b6879e5763f2ab5a84c27f140533db7d (diff)
Move system lib comment up, formatting, expand lib not found error.
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py30
1 files changed, 17 insertions, 13 deletions
diff --git a/setup.py b/setup.py
index 85de59d29..169a4f02b 100644
--- a/setup.py
+++ b/setup.py
@@ -27,6 +27,15 @@ is_win32 = sys.platform.startswith('win32')
# 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
+# How the build process finds the system libs:
+#
+# 1. if BORG_{LIBXXX,OPENSSL}_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.
+
# Are we building on ReadTheDocs?
on_rtd = os.environ.get('READTHEDOCS')
@@ -114,15 +123,6 @@ cmdclass = {
}
-# How the build process finds the system libs:
-#
-# 1. if BORG_{LIBXXX,OPENSSL}_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:
@@ -143,21 +143,25 @@ if not on_rtd:
def lib_ext_kwargs(pc, prefix_env_var, lib_name, lib_pkg_name, pc_version, lib_subdir='lib'):
system_prefix = os.environ.get(prefix_env_var)
if system_prefix:
- print(f'Detected and preferring {lib_pkg_name} [via {prefix_env_var}]')
+ 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_subdir)],
libraries=[lib_name])
if pc and pc.installed(lib_pkg_name, pc_version):
- print(f'Detected and preferring {lib_pkg_name} [via pkg-config]')
+ 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}')
+ raise Exception(
+ f"Could not find {lib_name} lib/headers, please set {prefix_env_var} "
+ f"or ensure {lib_pkg_name}.pc is in PKG_CONFIG_PATH."
+ )
if is_win32:
crypto_ext_lib = lib_ext_kwargs(
pc, 'BORG_OPENSSL_PREFIX', 'libcrypto', 'libcrypto', '>=1.1.1', lib_subdir='')
else:
- crypto_ext_lib = lib_ext_kwargs(pc, 'BORG_OPENSSL_PREFIX', 'crypto', 'libcrypto', '>=1.1.1')
+ crypto_ext_lib = lib_ext_kwargs(
+ pc, 'BORG_OPENSSL_PREFIX', 'crypto', 'libcrypto', '>=1.1.1')
crypto_ext_kwargs = members_appended(
dict(sources=[crypto_ll_source, crypto_helpers]),