Browse Source

Build instructions fixes

test_fixup
Vadim Lebedev 2 years ago
parent
commit
e58fb753ed
2 changed files with 15 additions and 8 deletions
  1. +3
    -3
      .github/workflows/build-wheels.yaml
  2. +12
    -5
      setup.py

+ 3
- 3
.github/workflows/build-wheels.yaml View File

@@ -51,14 +51,14 @@ jobs:
run: |
rm -rf build wheelhouse
touch libarchive/_libarchive.i
make clean
export LD_LIBRARY_PATH=/usr/local/lib64/:/usr/local/lib:$LD_LIBRARY_PATH
make install
export LIBARCHIVE_PREFIX=/usr/local
python3 setup.py install


- name: Build wheels
run: |
make wheel
pip wheel --wheel-dir dist/ .
auditwheel repair dist/*.whl
python3 -m pip install --force-reinstall wheelhouse/*,whl


+ 12
- 5
setup.py View File

@@ -36,13 +36,22 @@ except ImportError:
import subprocess
# Use a provided libarchive else default to hard-coded path.
libarchivePrefix = environ.get('LIBARCHIVE_PREFIX')
includePath = f"{libarchivePrefix or '/usr'}/include"
# retreive the version number form SWIG generated file
print("includePath:", (libarchivePrefix, includePath))
cmd = [
'awk',
'/ARCHIVE_VERSION_NUMBER/ { if (match($0,"[[:digit:]]+")) print substr($0, RSTART,RLENGTH) }',
"libarchive/_libarchive_wrap.c",
'/#define.*ARCHIVE_VERSION_NUMBER/ { if (match($0,"[[:digit:]]+")) print substr($0, RSTART,RLENGTH) }',
f"{includePath}/archive.h"
]
p = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
print("awk output:", p.stdout.decode('utf-8'))
vnum = int(p.stdout)
name = 'python-libarchive-ext'
@@ -78,8 +87,6 @@ class build_ext_extra(build_ext, object):
super(build_ext_extra, self).build_extension(ext)
# Use a provided libarchive else default to hard-coded path.
libarchivePrefix = environ.get('LIBARCHIVE_PREFIX')
if libarchivePrefix:
extra_compile_args = ['-I{0}/include'.format(libarchivePrefix)]
extra_link_args = ['-Wl,-rpath={0}/lib'.format(libarchivePrefix)]
@@ -90,7 +97,7 @@ else:
__libarchive = Extension(
name='libarchive.__libarchive',
sources=['libarchive/_libarchive.i', 'libarchive/_libarchive_wrap.c'],
sources=['libarchive/_libarchive.i'],
libraries=['archive'],
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,


Loading…
Cancel
Save