Skip to content

Commit 719ea2c

Browse files
committed
Format all project files with black
1 parent bb01e9a commit 719ea2c

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

conanfile.py

+10-9
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,9 @@ def pyver(self):
8888
"""Two-digit integer version, e.g. 3.7.3 -> 37"""
8989
return "".join(self.pyversion.split(".")[:2])
9090

91-
9291
def make_package_list(self):
9392
"""Create a list of package names based on `self.options.packages`
94-
93+
9594
For details of the `self.options.packages` format see `make_requirements_file`
9695
"""
9796

@@ -107,8 +106,7 @@ def split_lines(string):
107106
return string.split(" ")
108107

109108
packages_str = str(self.options.packages).strip()
110-
return split_lines(packages_str)
111-
109+
return split_lines(packages_str)
112110

113111
def make_requirements_file(self, extra_packages=None):
114112
"""Create a `requirements.txt` based on `self.options.packages` and return its path
@@ -155,7 +153,6 @@ def _gather_packages(self):
155153
with open("packages.txt", "w") as output:
156154
output.write("\n".join(package_names))
157155

158-
159156
def source(self):
160157
replace_in_file(self, "embedded_python.cmake", "${self.pyversion}", str(self.pyversion))
161158

@@ -303,6 +300,7 @@ def _openssl_path(self):
303300

304301
def generate(self):
305302
from conan.tools.gnu import AutotoolsToolchain, AutotoolsDeps
303+
306304
tc = AutotoolsToolchain(self.conanfile, prefix=self.prefix)
307305
tc.configure_args.extend(["--enable-shared", f"--with-openssl={self._openssl_path}"])
308306
tc.generate()
@@ -320,21 +318,24 @@ def generate(self):
320318
# the LD_LIBRARY_PATH env variable which is not at all what we want for this self-contained
321319
# package. Unlike RUNPATH, RPATH takes precedence over LD_LIBRARY_PATH.
322320
if self.conanfile.settings.os == "Linux":
323-
deps.environment.append("LDFLAGS", ["-Wl,-rpath='\$\$ORIGIN/../lib'", "-Wl,--disable-new-dtags"])
321+
deps.environment.append(
322+
"LDFLAGS", ["-Wl,-rpath='\$\$ORIGIN/../lib'", "-Wl,--disable-new-dtags"]
323+
)
324324

325325
deps.generate()
326326

327327
def build(self):
328328
from conan.tools.gnu import Autotools
329+
329330
autotools = Autotools(self.conanfile)
330331
autotools.configure()
331332
autotools.make()
332333

333334
def install(self):
334335
from conan.tools.gnu import Autotools
336+
335337
autotools = Autotools(self.conanfile)
336-
autotools.install(
337-
args=["DESTDIR=''"]) # already handled by `prefix=dest_dir`
338+
autotools.install(args=["DESTDIR=''"]) # already handled by `prefix=dest_dir`
338339

339340
ver = ".".join(self.conanfile.pyversion.split(".")[:2])
340341
exe = str(self.prefix / f"bin/python{ver}")
@@ -372,7 +373,7 @@ def _patch_libpython_path(self, exe):
372373

373374
buffer = StringIO()
374375
self.conanfile.run(f"otool -L {exe}", output=buffer)
375-
lines = buffer.getvalue().strip().split('\n')[1:]
376+
lines = buffer.getvalue().strip().split("\n")[1:]
376377
libraries = [line.split()[0] for line in lines]
377378

378379
prefix = str(self.prefix)

test_package/conanfile.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,21 @@ def _test_env(self):
5454
name = str(self.options.env) if self.options.env else "baseline"
5555
self.run(f"{python_exe} {project_root / name / 'test.py'}", run_environment=True)
5656

57-
5857
def _test_libpython_path(self):
5958
if self.settings.os != "Macos":
6059
return
6160

6261
python_exe = str(pathlib.Path("./bin/python/bin/python3").resolve())
6362
buffer = StringIO()
64-
self.run(f'otool -L {python_exe}', run_environment=True, output=buffer)
65-
lines = buffer.getvalue().strip().split('\n')[1:]
63+
self.run(f"otool -L {python_exe}", run_environment=True, output=buffer)
64+
lines = buffer.getvalue().strip().split("\n")[1:]
6665
libraries = [line.split()[0] for line in lines]
6766
candidates = [lib for lib in libraries if "libpython" in lib]
6867
assert candidates, f"libpython dependency not found in 'otool' output: {libraries}"
6968

7069
for lib in candidates:
7170
assert lib.startswith("@executable_path"), f"libpython has an unexpected prefix: {lib}"
7271

73-
7472
def _test_embed(self):
7573
"""Ensure that everything is available to compile and link to the embedded Python"""
7674
self.run(pathlib.Path("bin", "test_package"), run_environment=True)

0 commit comments

Comments
 (0)