Skip to content

Commit

Permalink
Switch to using only the pypi-13.1 repository (closes #808)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsmith committed Dec 11, 2023
1 parent e50e8da commit 826262d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
1 change: 0 additions & 1 deletion product/gradle-plugin/src/main/kotlin/PythonTasks.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion product/runtime/docs/sphinx/android.rst
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ install <https://pip.pypa.io/en/stable/cli/pip_install/>`_. For example::
In our most recent tests, Chaquopy could install over 90% of the top 1000 packages on `PyPI
<https://pypi.org/>`_. 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 <https://chaquo.com/pypi-7.0/>`_. To
available, you can `browse the repository here <https://chaquo.com/pypi-13.1/>`_. To
request a package to be added or updated, or for any other problem with installing
requirements, please visit our `issue tracker <https://github.com/chaquo/chaquopy/issues>`_.

Expand Down
4 changes: 2 additions & 2 deletions product/runtime/docs/sphinx/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <android-requirements>` of your build.gradle
file:

Expand Down
4 changes: 2 additions & 2 deletions server/pypi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 7 additions & 5 deletions server/pypi/build-wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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):
Expand All @@ -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}")
Expand Down Expand Up @@ -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}"

Expand Down

0 comments on commit 826262d

Please sign in to comment.