From 826262dee50f7abfd27edc9072996ddfe2ffbab2 Mon Sep 17 00:00:00 2001 From: Malcolm Smith Date: Mon, 11 Dec 2023 13:52:53 +0000 Subject: [PATCH] Switch to using only the pypi-13.1 repository (closes #808) --- product/gradle-plugin/src/main/kotlin/PythonTasks.kt | 1 - .../src/test/integration/test_gradle_plugin.py | 2 +- product/runtime/docs/sphinx/android.rst | 2 +- product/runtime/docs/sphinx/faq.rst | 4 ++-- server/pypi/README.md | 4 ++-- server/pypi/build-wheel.py | 12 +++++++----- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/product/gradle-plugin/src/main/kotlin/PythonTasks.kt b/product/gradle-plugin/src/main/kotlin/PythonTasks.kt index 570fb146b0..e420f9a16c 100644 --- a/product/gradle-plugin/src/main/kotlin/PythonTasks.kt +++ b/product/gradle-plugin/src/main/kotlin/PythonTasks.kt @@ -234,7 +234,6 @@ internal class TaskBuilder( args("--") args("--disable-pip-version-check") if (!customIndexUrl) { - args("--extra-index-url", "https://chaquo.com/pypi-7.0") args("--extra-index-url", "https://chaquo.com/pypi-13.1") } args("--implementation", Common.PYTHON_IMPLEMENTATION) diff --git a/product/gradle-plugin/src/test/integration/test_gradle_plugin.py b/product/gradle-plugin/src/test/integration/test_gradle_plugin.py index 94f97e4160..4ee7ca3004 100644 --- a/product/gradle-plugin/src/test/integration/test_gradle_plugin.py +++ b/product/gradle-plugin/src/test/integration/test_gradle_plugin.py @@ -888,7 +888,7 @@ def test_buildpython_missing(self): def test_download_wheel(self): # Our current version of pip shows the full URL for custom indexes, but only # the filename for PyPI. - CHAQUO_URL = (r"https://chaquo.com/pypi-7.0/murmurhash/" + CHAQUO_URL = (r"https://chaquo.com/pypi-13.1/murmurhash/" r"murmurhash-0.28.0-7-cp38-cp38-android_16_x86.whl") PYPI_URL = "six-1.14.0-py2.py3-none-any.whl" diff --git a/product/runtime/docs/sphinx/android.rst b/product/runtime/docs/sphinx/android.rst index 0ccb3dba5d..8b35e4524f 100644 --- a/product/runtime/docs/sphinx/android.rst +++ b/product/runtime/docs/sphinx/android.rst @@ -333,7 +333,7 @@ install `_. For example:: In our most recent tests, Chaquopy could install over 90% of the top 1000 packages on `PyPI `_. This includes almost all pure-Python packages, plus a constantly-growing selection of packages with native components. To see which native packages are currently -available, you can `browse the repository here `_. To +available, you can `browse the repository here `_. To request a package to be added or updated, or for any other problem with installing requirements, please visit our `issue tracker `_. diff --git a/product/runtime/docs/sphinx/faq.rst b/product/runtime/docs/sphinx/faq.rst index b5312b9b25..c523cd7a0f 100644 --- a/product/runtime/docs/sphinx/faq.rst +++ b/product/runtime/docs/sphinx/faq.rst @@ -151,8 +151,8 @@ To make your own mirror of our Maven repository: To make your own mirror of our pip repository: -* Download whatever packages your app needs from https://chaquo.com/pypi-7.0, and arrange them - in the same directory structure as the server. +* Download whatever packages your app needs from https://chaquo.com/pypi-13.1/, and + arrange them in the same directory structure as the server. * Add the following lines to the :ref:`pip block ` of your build.gradle file: diff --git a/server/pypi/README.md b/server/pypi/README.md index e817826a7d..149a12d109 100644 --- a/server/pypi/README.md +++ b/server/pypi/README.md @@ -105,8 +105,8 @@ Here are some examples of existing recipes: `setup.py` find the library. * scikit-learn: lists several requirements in `meta.yaml`: * The "build" requirement (Cython) will be installed automatically. - * The "host" requirements (NumPy etc.) must be downloaded manually from - [the public repository](https://chaquo.com/pypi-7.0/). Save them into a corresponding + * The "host" requirements (NumPy etc.) must be downloaded manually from [the public + repository](https://chaquo.com/pypi-13.1/). Save them into a corresponding subdirectory of `dist` (e.g. `dist/numpy`), before running the build. Then run build-wheel as shown above. diff --git a/server/pypi/build-wheel.py b/server/pypi/build-wheel.py index b6ed643eea..88435e63e2 100755 --- a/server/pypi/build-wheel.py +++ b/server/pypi/build-wheel.py @@ -180,7 +180,6 @@ def unpack_and_build(self): wheel_dir, ensure_dir(f"{PYPI_DIR}/dist/{normalize_name_pypi(self.package)}")) - def parse_args(self): ap = argparse.ArgumentParser(add_help=False) ap.add_argument("--help", action="help", help=argparse.SUPPRESS) @@ -408,7 +407,8 @@ def create_host_env(self): self.extract_target() for package, version in self.get_requirements("host"): - dist_dir = f"{PYPI_DIR}/dist/{normalize_name_pypi(package)}" + dist_subdir = normalize_name_pypi(package) + dist_dir = f"{PYPI_DIR}/dist/{dist_subdir}" matches = [] if exists(dist_dir): for filename in os.listdir(dist_dir): @@ -420,8 +420,10 @@ def create_host_env(self): if match and (int(match["api_level"]) <= self.api_level): matches.append(match) if not matches: - raise CommandError(f"Couldn't find compatible wheel for {package} " - f"{version} in {dist_dir}") + raise CommandError( + f"Couldn't find compatible wheel for {package} {version}. Try " + f"downloading it from https://chaquo.com/pypi-13.1/{dist_subdir}/ " + f"into {dist_dir}.") matches.sort(key=lambda match: int(match.group("build_num"))) wheel_filename = join(dist_dir, matches[-1].group(0)) run(f"unzip -d {self.host_env} -q {wheel_filename}") @@ -563,7 +565,7 @@ def get_python_env_vars(self, env, pypi_env): # complex.h functions were introduced between API levels 23 and 26. Make Cython # use its own implementations instead. if self.api_level < 26: - env["CFLAGS"] += f" -DCYTHON_CCOMPLEX=0" + env["CFLAGS"] += " -DCYTHON_CCOMPLEX=0" env["LDFLAGS"] += f" -lpython{self.python}"