Skip to content

Commit 34538de

Browse files
committed
Hackily allow skipping lxml dependency in setup.py.
For brew'ed planemo it is easier just to depend on xmllint.
1 parent aff880c commit 34538de

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

setup.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414
sys.stderr.write("ERROR: planemo requires at least Python Version 2.7\n")
1515
sys.exit(1)
1616

17+
# Allow installer to turn off dependency on lxml by setting the environment variable
18+
# PLANEMO_REQUIRE_LXML to "0". lxml should be considered optional if xmllint is
19+
# available on the PATH - but python doesn't really provide me a fantastic way to
20+
# express that.
21+
DEFAULT_PLANEMO_REQUIRE_LXML = 1
22+
PLANEMO_REQUIRE_LXML = os.environ.get("PLANEMO_REQUIRE_LXML", "%d" % DEFAULT_PLANEMO_REQUIRE_LXML) != "0"
23+
1724
SOURCE_DIR = "planemo"
1825

1926
_version_re = re.compile(r'__version__\s+=\s+(.*)')
@@ -81,6 +88,8 @@ def get_var(var_name):
8188
if os.path.exists("requirements.txt"):
8289
requirements = [ r for r in open("requirements.txt").read().split("\n") if ";" not in r ]
8390
py27_requirements = [ r.split(";", 1)[0].strip() for r in open("requirements.txt").read().split("\n") if ";" in r ]
91+
if not PLANEMO_REQUIRE_LXML:
92+
requirements.remove("lxml")
8493
else:
8594
# In tox, it will cover them anyway.
8695
requirements = []

0 commit comments

Comments
 (0)