Skip to content

Commit eb4d1b9

Browse files
nalinigansNalini Ganapati
andauthored
Read requirements.txt into setup.py and delocate cython library manually for local builds (#52)
Co-authored-by: Nalini Ganapati <[email protected]>
1 parent e082f3c commit eb4d1b9

File tree

3 files changed

+62
-2
lines changed

3 files changed

+62
-2
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ release: dist ## package and upload a release
9292
dist: ## builds source and wheel package
9393
python setup.py sdist --with-libs
9494
python setup.py bdist_wheel --with-libs
95+
package/scripts/delocate_wheel_local.sh
9596
ls -l dist
9697

9798
install: ## install the package to the active Python's site-packages
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#
2+
# delocate_wheel_local.sh
3+
#
4+
# The MIT License (MIT)
5+
# Copyright (c) 2024 dātma, inc™
6+
#
7+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
8+
# this software and associated documentation files (the "Software"), to deal in
9+
# the Software without restriction, including without limitation the rights to
10+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11+
# the Software, and to permit persons to whom the Software is furnished to do so,
12+
# subject to the following conditions:
13+
#
14+
# The above copyright notice and this permission notice shall be included in all
15+
# copies or substantial portions of the Software.
16+
#
17+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23+
#
24+
# Description: Script to delocate wheel by sanitizing native library paths
25+
#
26+
27+
#!/bin/bash
28+
29+
if [[ $(uname) == "Linux" ]]; then
30+
exit 0
31+
fi
32+
33+
pushd dist
34+
35+
mkdir genomicsdb
36+
for WHEEL in $(ls *.whl)
37+
do
38+
echo "delocating WHEEL=$WHEEL"
39+
VERSION=$(echo $WHEEL | grep -o cp... | head -n1 | cut -c 3-5)
40+
LIB=genomicsdb.cpython-$VERSION-darwin.so
41+
CYTHON_LIB=genomicsdb/$LIB
42+
rm -fr $CYTHON_LIB
43+
unzip -j $WHEEL $CYTHON_LIB > /dev/null
44+
mv $LIB genomicsdb
45+
ls $CYTHON_LIB > /dev/null
46+
if [[ $? != 0 ]]; then
47+
echo "Could not find CYTHON_LIB=$CYTHON_LIB"
48+
exit 1
49+
fi
50+
install_name_tool -change @rpath/libtiledbgenomicsdb.1.dylib @loader_path/lib/libtiledbgenomicsdb.1.dylib $CYTHON_LIB
51+
otool -L $CYTHON_LIB
52+
zip $WHEEL $CYTHON_LIB
53+
done
54+
rm -fr genomicsdb
55+
56+
popd

setup.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
GENOMICSDB_INSTALL_PATH = os.getenv("GENOMICSDB_HOME", default="genomicsdb")
4242
copy_genomicsdb_libs = False
4343
copy_protobuf_definitions = False
44-
with_version = "0.0.9.3"
44+
with_version = "0.0.9.14"
4545

4646
args = sys.argv[:]
4747
for arg in args:
@@ -143,6 +143,9 @@ def run_cythonize(src):
143143
with open("README.md") as f:
144144
long_description = f.read()
145145

146+
with open("requirements.txt") as f:
147+
install_requirements = f.readlines()
148+
146149
setup(
147150
name="genomicsdb",
148151
description="Experimental Python Bindings for querying GenomicsDB",
@@ -156,7 +159,7 @@ def run_cythonize(src):
156159
ext_modules=[genomicsdb_extension],
157160
zip_safe=False,
158161
setup_requires=["cython>=0.27"],
159-
install_requires=["numpy>=1.19.5", "pandas", "protobuf>=4.21.1"],
162+
install_requires=install_requirements,
160163
python_requires=">=3.9",
161164
packages=find_packages(exclude=["package", "test"]),
162165
keywords=["genomics", "genomicsdb", "variant", "vcf", "variant calls"],

0 commit comments

Comments
 (0)