Skip to content

Commit e9cb7e7

Browse files
committed
Build Pillow without JPEG support
1 parent a7f3eee commit e9cb7e7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

graalpython/lib-graalpython/modules/ginstall.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ def cassowary(**kwargs):
381381
def Pillow(**kwargs):
382382
setuptools(**kwargs)
383383
build_env = {"MAX_CONCURRENCY": "0"}
384-
install_from_pypi("Pillow==6.2.0", env=build_env, **kwargs)
384+
install_from_pypi("Pillow==6.2.0", build_cmd=["build_ext", "--disable-jpeg"], env=build_env, **kwargs)
385385

386386
@pip_package()
387387
def matplotlib(**kwargs):
@@ -449,7 +449,7 @@ def _download_with_curl_and_extract(dest_dir, url):
449449
return bare_name
450450

451451

452-
def _install_from_url(url, package, extra_opts=[], add_cflags="", ignore_errors=False, env={}, version=None, pre_install_hook=None):
452+
def _install_from_url(url, package, extra_opts=[], add_cflags="", ignore_errors=False, env={}, version=None, pre_install_hook=None, build_cmd=[]):
453453
tempdir = tempfile.mkdtemp()
454454

455455
os_env = os.environ
@@ -487,7 +487,7 @@ def _install_from_url(url, package, extra_opts=[], add_cflags="", ignore_errors=
487487
user_arg = ["--user"]
488488
else:
489489
user_arg = []
490-
status = run_cmd([sys.executable, "setup.py", "install"] + user_arg + extra_opts, env=setup_env,
490+
status = run_cmd([sys.executable, "setup.py"] + build_cmd + ["install"] + user_arg + extra_opts, env=setup_env,
491491
cwd=os.path.join(tempdir, bare_name))
492492
if status != 0 and not ignore_errors:
493493
xit("An error occurred trying to run `setup.py install %s %s'" % (user_arg, " ".join(extra_opts)))
@@ -522,7 +522,7 @@ def read_first_existing(pkg_name, versions, dir, suffix):
522522

523523
# end of code duplicated in pip_hook.py
524524

525-
def install_from_pypi(package, extra_opts=[], add_cflags="", ignore_errors=True, env=None, pre_install_hook=None):
525+
def install_from_pypi(package, extra_opts=[], add_cflags="", ignore_errors=True, env=None, pre_install_hook=None, build_cmd=[]):
526526
package_pattern = os.environ.get("GINSTALL_PACKAGE_PATTERN", "https://pypi.org/pypi/%s/json")
527527
package_version_pattern = os.environ.get("GINSTALL_PACKAGE_VERSION_PATTERN", "https://pypi.org/pypi/%s/%s/json")
528528

@@ -567,7 +567,8 @@ def set_if_exists(env_var, conf_var):
567567

568568
if url:
569569
_install_from_url(url, package=package, extra_opts=extra_opts, add_cflags=add_cflags,
570-
ignore_errors=ignore_errors, env=env, version=version, pre_install_hook=pre_install_hook)
570+
ignore_errors=ignore_errors, env=env, version=version, pre_install_hook=pre_install_hook,
571+
build_cmd=build_cmd)
571572
else:
572573
xit("Package not found: '%s'" % package)
573574

0 commit comments

Comments
 (0)