Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not require downloading xbuildenv when updating package recipes #30

Merged
2 changes: 1 addition & 1 deletion pyodide_build/build_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def search_pyodide_root(curdir: str | Path, *, max_depth: int = 10) -> Path | No
"""
Recursively search for the root of the Pyodide repository,
by looking for the pyproject.toml file in the parent directories
which contains [tool.pyodide] section.
which contains the [tool._pyodide] section.
"""
pyproject_path, pyproject_file = search_pyproject_toml(curdir, max_depth)

Expand Down
17 changes: 12 additions & 5 deletions pyodide_build/cli/skeleton.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,25 @@ def new_recipe_pypi(
),
) -> None:
"""
Create a new package from PyPI.
Create a new package recipe from PyPI or update an existing recipe.
"""

# Determine the recipe directory. If it is specified by the user, we use that;
# otherwise, we assume that the recipe directory is the ``packages`` directory
# in the root of the Pyodide tree, without the need to initialize the
# cross-build environment.
#
# It is unlikely that a user will run this command outside of the Pyodide
# tree, so we do not need to initialize the environment at this stage.

if recipe_dir:
recipe_dir_ = Path(recipe_dir)
else:
cwd = Path.cwd()
root = build_env.search_pyodide_root(curdir=cwd)

if build_env.in_xbuildenv():
if not root:
root = cwd
else:
root = build_env.search_pyodide_root(cwd) or cwd

recipe_dir_ = root / "packages"

Expand All @@ -76,7 +83,7 @@ def new_recipe_pypi(
logger.error(f"{name} update failed: {e}")
sys.exit(1)
except mkpkg.MkpkgSkipped as e:
logger.warn(f"{name} update skipped: {e}")
logger.warning(f"{name} update skipped: {e}")
except Exception:
print(name)
raise
Expand Down
2 changes: 1 addition & 1 deletion pyodide_build/mkpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def update_package(
meta_path = root / package / "meta.yaml"
if not meta_path.exists():
logger.error(f"{meta_path} does not exist")
exit(1)
raise MkpkgFailedException(f"{package} recipe not found at {meta_path}")

yaml_content = yaml.load(meta_path.read_bytes())

Expand Down
Loading