Skip to content

Commit d2853ba

Browse files
committed
Pass special CFLAGS only for pandas.
1 parent 4ea21f0 commit d2853ba

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

graalpython/lib-graalpython/modules/ginstall.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
import sys
4747
import tempfile
4848

49-
5049
def system(cmd, msg=""):
5150
status = os.system(cmd)
5251
if status != 0:
@@ -378,8 +377,9 @@ def pandas(*args):
378377
dinfo->abstime = (double)(hour * 3600 + minute * 60) + second;
379378
380379
"""
381-
install_from_url("https://files.pythonhosted.org/packages/ee/aa/90c06f249cf4408fa75135ad0df7d64c09cf74c9870733862491ed5f3a50/pandas-0.20.3.tar.gz", patch=patch, extra_opts=args)
382-
380+
cflags = "-allowcpp" if sys.implementation.name == "graalpython" else ""
381+
install_from_url("https://files.pythonhosted.org/packages/ee/aa/90c06f249cf4408fa75135ad0df7d64c09cf74c9870733862491ed5f3a50/pandas-0.20.3.tar.gz", patch=patch, extra_opts=args, cflags=cflags)
382+
383383
return locals()
384384

385385

@@ -391,7 +391,7 @@ def xit(msg, status=-1):
391391
exit(-1)
392392

393393

394-
def install_from_url(url, patch=None, extra_opts=[]):
394+
def install_from_url(url, patch=None, extra_opts=[], cflags=""):
395395
name = url[url.rfind("/")+1:]
396396
tempdir = tempfile.mkdtemp()
397397

@@ -417,7 +417,7 @@ def install_from_url(url, patch=None, extra_opts=[]):
417417
system("patch -d %s/%s/ -p1 < %s/%s.patch" % ((tempdir, bare_name)*2))
418418

419419
user_arg = "--user" if "--prefix" not in extra_opts else ""
420-
system("cd %s/%s; %s setup.py install %s %s" % (tempdir, bare_name, sys.executable, user_arg, " ".join(extra_opts)))
420+
system("cd %s/%s; %s %s setup.py install %s %s" % (tempdir, bare_name, "CFLAGS=%s" % cflags if cflags else "", sys.executable, user_arg, " ".join(extra_opts)))
421421

422422

423423
def install_from_pypi(package, extra_opts=[]):
@@ -537,7 +537,7 @@ def main(argv):
537537
if pkg not in KNOWN_PACKAGES:
538538
xit("Unknown package: '%s'" % pkg)
539539
else:
540-
if "prefix" in args:
540+
if args.prefix:
541541
KNOWN_PACKAGES[pkg]("--prefix", args.prefix)
542542
else:
543543
KNOWN_PACKAGES[pkg]()

0 commit comments

Comments
 (0)