From d6c2053eaaebc0ab0e860153b9b71bed55ca11e8 Mon Sep 17 00:00:00 2001
From: Blaise Li <blaise.li__git@nsup.org>
Date: Fri, 16 Aug 2019 14:12:58 +0200
Subject: [PATCH] Half-workaround pybedtools issue.

For the moment, bam25prime needs bedtools sources to be installed, in a
specific location, and in a specific version (2.27.0).
---
 README.md | 21 ++++++++++++++++++++-
 setup.py  |  6 ++++--
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 1af164b..7621b66 100644
--- a/README.md
+++ b/README.md
@@ -9,9 +9,28 @@ It might also work directly:
 
     python3 -m pip install git+ssh://git@gitlab.pasteur.fr/bli/bam25prime.git
 
+
+### Troubleshooting
+
+Compilation may fail if the version of `gcc` is too old.
+
+On a cluster with environment modules, a workaround might be something like running `module load gcc/7.2.0`.
+
+You may encounter the following error:
+
+    ImportError: liblzma.so.5: cannot open shared object file: No such file or directory
+
+You need to locate this `liblzma.so.5` file. If you find it, then set the
+`LD_LIBRARY_PATH` environment variable so that it points to the directory
+containing it. For instance:
+
+    export LD_LIBRARY_PATH="/local/gensoft2/exe/xz/5.2.2/lib"
+
+
+
 ## Usage
 
-This package provides a `bam25prime`.
+This package provides a `bam25prime` script.
 Its help can be obtained using option `-h` or `--help`.
 
 ```
diff --git a/setup.py b/setup.py
index fdbd152..dfce3b4 100644
--- a/setup.py
+++ b/setup.py
@@ -1,9 +1,11 @@
+from os import environ
 from setuptools import setup, find_packages
 from glob import glob
 # If you have .pyx things to cythonize
 from distutils.extension import Extension
 from Cython.Build import cythonize
-from pybedtools.helpers import get_includes as pybedtools_get_includes
+# https://github.com/daler/pybedtools/issues/253
+# from pybedtools.helpers import get_includes as pybedtools_get_includes
 from pysam import get_include as pysam_get_include
 
 name = "bam25prime"
@@ -16,7 +18,7 @@ extensions = [
         include_dirs=pysam_get_include()),
     Extension(
         "bam25prime.libcollapsebed", ["bam25prime/libcollapsebed.pyx"],
-        include_dirs=glob("/home/bli/src/bedtools2-2.27.1/src/utils/*"),
+        include_dirs=glob("%s/src/bedtools2-2.27.1/src/utils/*" % environ["HOME"]),
         #include_dirs=pybedtools_get_includes(),
         language="c++"),
     ]
-- 
GitLab