Permalink
Browse files

Hackily allow skipping lxml dependency in setup.py.

For brew'ed planemo it is easier just to depend on xmllint.
  • Loading branch information...
jmchilton committed Sep 23, 2016
1 parent aff880c commit 34538deaa242087c552080a6afdc489d5f2afb81
Showing with 9 additions and 0 deletions.
  1. +9 −0 setup.py
@@ -14,6 +14,13 @@
sys.stderr.write("ERROR: planemo requires at least Python Version 2.7\n")
sys.exit(1)

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

SOURCE_DIR = "planemo"

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

0 comments on commit 34538de

Please sign in to comment.