Skip to content

Commit b0c6b0f

Browse files
committed
[GR-45385] ginstall: remove legacy supported packages, delegate to pip.
PullRequest: graalpython/2762
2 parents fcdaa68 + 3938e3e commit b0c6b0f

File tree

6 files changed

+46
-104
lines changed

6 files changed

+46
-104
lines changed

graalpython/lib-graalpython/modules/ginstall.py

Lines changed: 4 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -84,49 +84,6 @@ def get_module_name(package_name):
8484
return module_name.replace('-', '_')
8585

8686

87-
def have_flang_new():
88-
env_path = os.environ.get('PATH', '').split(os.pathsep)
89-
for p in env_path:
90-
flang_new = os.path.join(p, 'flang-new')
91-
if os.path.isfile(flang_new):
92-
return True
93-
return False
94-
95-
96-
def get_flang_new_lib_dir():
97-
try:
98-
output = subprocess.check_output(['flang-new', '--version'])
99-
except (OSError, subprocess.CalledProcessError):
100-
pass
101-
else:
102-
flang_dir = output.splitlines()[-1].split()[-1].strip().decode("utf-8")
103-
return os.path.normpath(os.path.join(flang_dir, '..', 'lib'))
104-
return None
105-
106-
107-
def get_path_env_var(var):
108-
env_var = os.environ.get(var, None)
109-
if isinstance(env_var, str) and env_var.lower() == 'none':
110-
env_var = None
111-
if isinstance(env_var, str) and not os.path.exists(env_var):
112-
env_var = None
113-
return env_var
114-
115-
116-
def have_lapack():
117-
lapack_env = get_path_env_var('LAPACK')
118-
return lapack_env is not None
119-
120-
121-
def have_openblas():
122-
blas_env = get_path_env_var('BLAS')
123-
return blas_env and 'openblas' in blas_env
124-
125-
126-
def append_env_var(env, var, value):
127-
env[var] = '{} {}'.format(env.get(var, ''), value)
128-
129-
13087
def pip_package(name=None, try_import=False):
13188
def decorator(func):
13289
def wrapper(*args, **kwargs):
@@ -165,59 +122,10 @@ def run_cmd(args, msg="", failOnError=True, cwd=None, env=None, quiet=False, **k
165122

166123

167124
def known_packages():
168-
@pip_package()
169-
def h5py(**kwargs):
170-
install_with_pip('numpy')
171-
install_from_pypi("h5py==2.10.0", **kwargs)
172-
173-
@pip_package()
174-
def lightfm(**kwargs):
175-
install_with_pip('requests')
176-
install_from_pypi("lightfm==1.15", **kwargs)
177-
178-
@pip_package()
179-
def ninja(**kwargs):
180-
install_with_pip("scikit-build==0.16.6")
181-
ninja_build_env = {}
182-
if sys.platform.startswith('linux'):
183-
ninja_build_env = {
184-
'CC': 'gcc',
185-
'CXX': 'g++',
186-
}
187-
install_with_pip("ninja==1.11.1", env=ninja_build_env, **kwargs)
188-
189-
@pip_package(name="PIL")
190-
def Pillow(**kwargs):
191-
install_with_pip('setuptools')
192-
build_env = {"MAX_CONCURRENCY": "0"}
193-
build_cmd = ["build_ext", "--disable-jpeg"]
194-
zlib_root = os.environ.get("ZLIB_ROOT", None)
195-
if zlib_root:
196-
build_cmd += ["-I", os.path.join(zlib_root, "include"), "-L", os.path.join(zlib_root, "lib")]
197-
else:
198-
info("If Pillow installation fails due to missing zlib, try to set environment variable ZLIB_ROOT.")
199-
install_from_pypi("Pillow==9.2.0", build_cmd=build_cmd, env=build_env, **kwargs)
200-
201-
@pip_package()
202-
def matplotlib(**kwargs):
203-
install_with_pip('setuptools')
204-
install_with_pip('certifi')
205-
install_with_pip('cycler')
206-
install_with_pip('cassowary')
207-
install_with_pip('pyparsing')
208-
install_with_pip('python_dateutil')
209-
install_with_pip('numpy')
210-
Pillow(**kwargs)
211-
install_with_pip('kiwisolver')
212-
213-
def download_freetype(extracted_dir):
214-
target_dir = os.path.join(extracted_dir, "build")
215-
os.makedirs(target_dir, exist_ok=True)
216-
package_pattern = os.environ.get("GINSTALL_PACKAGE_PATTERN", "https://sourceforge.net/projects/freetype/files/freetype2/2.6.1/%s.tar.gz")
217-
_download_with_curl_and_extract(target_dir, package_pattern % "freetype-2.6.1")
218-
219-
install_from_pypi("matplotlib==3.3.3", pre_install_hook=download_freetype, **kwargs)
220-
125+
# @pip_package()
126+
# def lightfm(**kwargs):
127+
# install_with_pip('requests')
128+
# install_from_pypi("lightfm==1.15", **kwargs)
221129
return locals()
222130

223131

graalpython/lib-graalpython/patches/gast/metadata.toml

Lines changed: 0 additions & 2 deletions
This file was deleted.

graalpython/lib-graalpython/patches/matplotlib/matplotlib-3.7.0.patch

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
diff -u -r a/setupext.py b/setupext.py
1+
diff --git a/setupext.py b/setupext.py
2+
index a898d64..1f0b0b4 100644
23
--- a/setupext.py
34
+++ b/setupext.py
4-
@@ -631,7 +631,7 @@
5+
@@ -631,7 +631,7 @@ class FreeType(SetupPackage):
56
var: value
67
for var, value in sysconfig.get_config_vars().items()
78
if var in {"CC", "CFLAGS", "CXX", "CXXFLAGS", "LD",
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
[[rules]]
22
version = '== 0.12.0'
3-
patch = 'pythran-0.12.0.patch'
3+
patch = 'pythran-0.12.0.patch'
4+
5+
[[rules]]
6+
install-priority = 10
7+
version = '== 0.13.*'
8+
patch = 'pythran-0.13.patch'
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
diff --git a/pythran/pythonic/python/core.hpp b/pythran/pythonic/python/core.hpp
2+
index ff44c01..23b4413 100644
3+
--- a/pythran/pythonic/python/core.hpp
4+
+++ b/pythran/pythonic/python/core.hpp
5+
@@ -53,7 +53,7 @@ namespace python
6+
{
7+
8+
#ifndef PyString_AS_STRING
9+
-#define PyString_AS_STRING (char *)_PyUnicode_COMPACT_DATA
10+
+#define PyString_AS_STRING PyBytes_AS_STRING
11+
#endif
12+
13+
inline void PyObject_TypePrettyPrinter(std::ostream &oss, PyObject *obj)
14+
diff --git a/pythran/pythonic/types/str.hpp b/pythran/pythonic/types/str.hpp
15+
index 1f7a981..00440a9 100644
16+
--- a/pythran/pythonic/types/str.hpp
17+
+++ b/pythran/pythonic/types/str.hpp
18+
@@ -744,7 +744,7 @@ namespace std
19+
#define PyString_Check(x) PyUnicode_Check(x) && PyUnicode_IS_COMPACT_ASCII(x)
20+
#endif
21+
#ifndef PyString_AS_STRING
22+
-#define PyString_AS_STRING (char *)_PyUnicode_COMPACT_DATA
23+
+#define PyString_AS_STRING PyBytes_AS_STRING
24+
#endif
25+
#ifndef PyString_GET_SIZE
26+
#define PyString_GET_SIZE PyUnicode_GET_LENGTH

graalpython/lib-graalpython/patches/scipy/scipy-1.10.1.patch

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ index 00000000..afa33ecc
104104
+ with env_vars(scipy_build_env):
105105
+ return mesonpy.build_sdist(sdist_directory, config_settings=config_settings)
106106
diff --git a/pyproject.toml b/pyproject.toml
107-
index 454a3c2e..370f0e8e 100644
107+
index 454a3c2e..a4157fea 100644
108108
--- a/pyproject.toml
109109
+++ b/pyproject.toml
110-
@@ -8,7 +8,9 @@
110+
@@ -8,55 +8,21 @@
111111
# "pybind11>=2.4.3,<2.5.0",
112112

113113
[build-system]
@@ -118,7 +118,11 @@ index 454a3c2e..370f0e8e 100644
118118
requires = [
119119
"meson-python>=0.11.0,<0.13.0",
120120
"Cython>=0.29.32,<3.0",
121-
@@ -19,44 +21,8 @@ requires = [
121+
# conservatively avoid issues from
122+
# https://github.com/pybind/pybind11/issues/4420
123+
"pybind11==2.10.1",
124+
- "pythran>=0.12.0,<0.13.0",
125+
+ "pythran>=0.13.0",
122126
# `wheel` is needed for non-isolated builds, given that `meson-python`
123127
# doesn't list it as a runtime requirement (at least in 0.5.0)
124128
"wheel<0.39.0",

0 commit comments

Comments
 (0)