Skip to content

Commit c5ee1a9

Browse files
committed
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.
1 parent 08725ee commit c5ee1a9

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ if available.
3232

3333
You can also install from a clone of the git repository by running `pip install .` from the repository root directory.
3434
Editable installs are supported. Please note that running `setup.py` directly is no longer supported for PEP 517
35-
compliant packages. When building from the repo, because libusb 1.0.24 does not support out of tree builds, the build is
36-
done in-place in the `src/libusb` directory. `make clean` is run before compiling to ensure a clean build.
35+
compliant packages. Building libusb is done out of tree in an automatically created build directory for libusb 1.0.25
36+
and later.
3737

3838

3939
## APIs
@@ -42,7 +42,7 @@ There are four public functions exported by `libusb_package`.
4242

4343
- `find(*args, **kwargs)`: Wrapper around pyusb's `usb.core.find()` that sets the `backend`
4444
parameter to a libusb1 backend created from the libusb library included in `libusb_package`.
45-
All other parameters are passed unmodified
45+
All other parameters are passed unmodified.
4646

4747
- `get_libusb1_backend()`: Returns a `pyusb` backend object for the libusb version contained
4848
in `libusb_package`.

setup.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2021 Chris Reed
1+
# Copyright (c) 2021-2022 Chris Reed
22
# Copyright (c) 2022 Mitchell Kline
33
#
44
# SPDX-License-Identifier: Apache-2.0
@@ -97,12 +97,10 @@ def run(self):
9797
build_lib = ROOT_DIR / Path(build_py.get_package_dir(PACKAGE_NAME)).parent
9898
else:
9999
build_lib = Path(os.path.abspath(self.build_lib))
100-
# build_temp = Path(os.path.abspath(self.build_temp))
101100

102-
# Build in-tree for the time being. libusb commit 1001cb5 adds support for out of tree builds, but
103-
# this is not yet supported in an existing release. Once libusb version 1.0.25 is released, we can
104-
# build out of tree.
105-
build_temp = LIBUSB_DIR
101+
# Build out of tree. Requires libusb commit 1001cb5 which adds support for out of tree builds, present
102+
# in libusb 1.0.25 and later.
103+
build_temp = Path(os.path.abspath(self.build_temp))
106104

107105
print(f"build_temp = {build_temp}")
108106
print(f"build_lib = {build_lib}")
@@ -156,7 +154,6 @@ def run(self):
156154
self.spawn(['env']) # Dump environment for debugging purposes.
157155
self.spawn(['bash', str(BOOTSTRAP_SCRIPT)])
158156
self.spawn(['bash', str(CONFIGURE_SCRIPT), *extra_configure_args])
159-
self.spawn(['make', 'clean'])
160157
self.spawn(['make', f'-j{os.cpu_count() or 4}', 'all'])
161158
except Exception as err:
162159
# Exception is caught here and reraised as our specific Exception class because the actual

0 commit comments

Comments
 (0)