From b7d95815917bc70a134d596f00a702e5f6cd03a2 Mon Sep 17 00:00:00 2001 From: Chris Reed Date: Mon, 21 Feb 2022 17:26:31 -0600 Subject: [PATCH] setup.py: switch to out of tree builds. libusb 1.0.25 added support for out of tree builds. Removed no longer needed run of 'make clean' for posix builds. Updated readme. --- README.md | 6 +++--- setup.py | 11 ++++------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 3147ec0..1c6b1a3 100644 --- a/README.md +++ b/README.md @@ -32,8 +32,8 @@ if available. You can also install from a clone of the git repository by running `pip install .` from the repository root directory. Editable installs are supported. Please note that running `setup.py` directly is no longer supported for PEP 517 -compliant packages. When building from the repo, because libusb 1.0.24 does not support out of tree builds, the build is -done in-place in the `src/libusb` directory. `make clean` is run before compiling to ensure a clean build. +compliant packages. Building libusb is done out of tree in an automatically created build directory for libusb 1.0.25 +and later. ## APIs @@ -42,7 +42,7 @@ There are four public functions exported by `libusb_package`. - `find(*args, **kwargs)`: Wrapper around pyusb's `usb.core.find()` that sets the `backend` parameter to a libusb1 backend created from the libusb library included in `libusb_package`. - All other parameters are passed unmodified + All other parameters are passed unmodified. - `get_libusb1_backend()`: Returns a `pyusb` backend object for the libusb version contained in `libusb_package`. diff --git a/setup.py b/setup.py index 3b51011..334ca89 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Chris Reed +# Copyright (c) 2021-2022 Chris Reed # # SPDX-License-Identifier: Apache-2.0 # @@ -86,12 +86,10 @@ def run(self): build_lib = ROOT_DIR / Path(build_py.get_package_dir(PACKAGE_NAME)).parent else: build_lib = Path(os.path.abspath(self.build_lib)) -# build_temp = Path(os.path.abspath(self.build_temp)) - # Build in-tree for the time being. libusb commit 1001cb5 adds support for out of tree builds, but - # this is not yet supported in an existing release. Once libusb version 1.0.25 is released, we can - # build out of tree. - build_temp = LIBUSB_DIR + # Build out of tree. Requires libusb commit 1001cb5 which adds support for out of tree builds, present + # in libusb 1.0.25 and later. + build_temp = Path(os.path.abspath(self.build_temp)) print(f"build_temp = {build_temp}") print(f"build_lib = {build_lib}") @@ -142,7 +140,6 @@ def run(self): self.spawn(['env']) # Dump environment for debugging purposes. self.spawn(['bash', str(BOOTSTRAP_SCRIPT)]) self.spawn(['bash', str(CONFIGURE_SCRIPT), *extra_configure_args]) - self.spawn(['make', 'clean']) self.spawn(['make', f'-j{os.cpu_count() or 4}', 'all']) except Exception as err: # Exception is caught here and reraised as our specific Exception class because the actual