Skip to content

Commit

Permalink
Merge pull request #1282 from HaoZeke/fixEnvironmentBuilds
Browse files Browse the repository at this point in the history
BUG: Fix poetry / pdm usage
  • Loading branch information
mattip committed Apr 30, 2023
2 parents 4898e44 + c5adfea commit 5da0dd3
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions asv/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,13 @@ def __init__(self, conf, python, requirements, tagged_env_vars):
self._cache = build_cache.BuildCache(conf, self._path)
self._build_root = os.path.abspath(os.path.join(self._path, 'project'))

self._requirements = requirements
if (Path.cwd() / "poetry.lock").exists():
self._requirements["poetry-core"] = ""

if (Path.cwd() / "pdm.lock").exists():
self._requirements["pdm"] = ""

self._build_command = conf.build_command
self._install_command = conf.install_command
self._uninstall_command = conf.uninstall_command
Expand Down Expand Up @@ -612,6 +619,7 @@ def dir_name(self):

@property
def requirements(self):
"""Return the requirements"""
return self._requirements

@property
Expand Down Expand Up @@ -872,24 +880,11 @@ def has_file(file_name):

if cmd is None:
if has_file('pyproject.toml'):
if has_file('pdm.lock'):
cmd = [
"python -mpip install pdm",
"pdm install --prod",
"pdm build --wheel --no-isolation --output {build_cache_dir}"
]
elif has_file('poetry.lock'):
cmd = [
"python -mpip install poetry",
"poetry install",
"poetry build --format wheel --output {build_cache_dir}"
]
else:
cmd = [
("PIP_NO_BUILD_ISOLATION=false "
"python -mpip wheel --no-deps --no-index "
"-w {build_cache_dir} {build_dir}")
]
cmd = [
("PIP_NO_BUILD_ISOLATION=false "
"python -mpip wheel --no-deps --no-index "
"-w {build_cache_dir} {build_dir}")
]
else:
cmd = [
"python setup.py build",
Expand Down

0 comments on commit 5da0dd3

Please sign in to comment.