Skip to content
Snippets Groups Projects
Commit a811844d authored by Blaise Li's avatar Blaise Li
Browse files

Trying setup_required.

Seems to work for cython/Cython. Attempt to use it for pysam and
pybedtools failed. Install of pybedtools from source (to use unmerged
fork providing headers) requires cythonizing, which might be done using
--global-option="cythonize" option. Now this needs to be checked, and
also: how to have it done as part of automatic dependency install?
parent 99a8dcd6
No related branches found
No related tags found
No related merge requests found
#!/bin/sh #!/bin/sh
#/usr/bin/env python3 setup.py build_ext #/usr/bin/env python3 setup.py build_ext
# .egg-link does not work with PYTHONPATH ? # .egg-link does not work with PYTHONPATH ?
/usr/bin/env python3 -m pip install -e . /usr/bin/env python3 -m pip install --no-build-isolation -e .
/usr/bin/env python3 -m pip install --no-deps --ignore-installed . /usr/bin/env python3 -m pip install --no-build-isolation --no-deps --ignore-installed .
[build-system] [build-system]
requires = ["setuptools", "Cython"] requires = [
#"wheel",
"pysam",
"pybedtools @ git+https://github.com/blaiseli/pybedtools.git@fix_missing_headers",
#"Cython"
]
build-backend = "setuptools.build_meta" build-backend = "setuptools.build_meta"
from os import environ from os import environ, PathLike
from setuptools import setup, find_packages from setuptools import setup, find_packages
# from glob import glob # from glob import glob
# If you have .pyx things to cythonize # If you have .pyx things to cythonize
from distutils.extension import Extension from distutils.extension import Extension
from Cython.Build import cythonize #from Cython.Build import cythonize
# https://github.com/daler/pybedtools/issues/253 # https://github.com/daler/pybedtools/issues/253
from pybedtools.helpers import get_includes as pybedtools_get_includes from pybedtools.helpers import get_includes as pybedtools_get_includes
from pysam import get_include as pysam_get_include from pysam import get_include as pysam_get_include
...@@ -11,14 +11,34 @@ from pysam import get_include as pysam_get_include ...@@ -11,14 +11,34 @@ from pysam import get_include as pysam_get_include
name = "bam25prime" name = "bam25prime"
__version__ = "0.1" __version__ = "0.1"
# https://stackoverflow.com/a/54138355/1878788
# defer the import of these modules after setup_requires have been provided
#class pysam_get_includes(str):
# def __str__(self):
# from pysam import get_include
# includes = get_include()
# print(*includes, sep="\n")
# return "|".join(includes)
#
#class pybedtools_get_includes(str):
# def __str__(self):
# from pybedtools.helpers import get_includes
# includes = get_includes()
# print(*includes, sep="\n")
# return "|".join(includes)
# https://github.com/cython/cython/blob/master/docs/src/reference/compilation.rst#configuring-the-c-build # https://github.com/cython/cython/blob/master/docs/src/reference/compilation.rst#configuring-the-c-build
extensions = [ extensions = [
Extension( Extension(
"bam25prime.libcollapsesam", ["bam25prime/libcollapsesam.pyx"], "bam25prime.libcollapsesam", ["bam25prime/libcollapsesam.pyx"],
#include_dirs=pysam_get_includes().split("|")),
include_dirs=pysam_get_include()), include_dirs=pysam_get_include()),
Extension( Extension(
"bam25prime.libcollapsebed", ["bam25prime/libcollapsebed.pyx"], "bam25prime.libcollapsebed", ["bam25prime/libcollapsebed.pyx"],
#include_dirs=glob("%s/src/bedtools2-2.27.1/src/utils/*" % environ["HOME"]), #include_dirs=glob("%s/src/bedtools2-2.27.1/src/utils/*" % environ["HOME"]),
#include_dirs=pybedtools_get_includes().split("|"),
include_dirs=pybedtools_get_includes(), include_dirs=pybedtools_get_includes(),
language="c++"), language="c++"),
] ]
...@@ -36,9 +56,20 @@ setup( ...@@ -36,9 +56,20 @@ setup(
"console_scripts": ["bam25prime = bam25prime.bam25prime:main",] "console_scripts": ["bam25prime = bam25prime.bam25prime:main",]
}, },
# scripts=["bin/%s" % name], # scripts=["bin/%s" % name],
ext_modules = cythonize(extensions), #ext_modules = cythonize(extensions),
ext_modules = extensions,
#ext_modules = cythonize("bam25prime/libbam25prime.pyx", include_path=pysam_get_include()), #ext_modules = cythonize("bam25prime/libbam25prime.pyx", include_path=pysam_get_include()),
install_requires=["pysam", "pybedtools"]) setup_requires=[
"wheel",
"cython",
#"pysam",
#"pybedtools @ git+https://github.com/blaiseli/pybedtools.git@fix_missing_headers"
],
install_requires=[
"pysam",
"pybedtools @ git+https://github.com/blaiseli/pybedtools.git@fix_missing_headers"
]
)
# If you have .pyx things to cythonize # If you have .pyx things to cythonize
#ext_modules = cythonize("libsmallrna/libsmallrna.pyx"), #ext_modules = cythonize("libsmallrna/libsmallrna.pyx"),
#install_requires=["cytoolz"], #install_requires=["cytoolz"],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment