Skip to content

Commit

Permalink
BUG: Don't use build if not present
Browse files Browse the repository at this point in the history
Set the project builder accordingly
  • Loading branch information
HaoZeke committed Feb 18, 2024
1 parent 6b32f22 commit 5269845
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions asv/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -918,22 +918,18 @@ def _build_project(self, repo, commit_hash, build_dir):
"""
build_dir_path = Path(build_dir)

def has_file(file_name):
return (build_dir_path / file_name).exists()

cmd = self._build_command

if cmd is None:
if has_file('pyproject.toml'):
cmd = [
"python -m build",
"python -mpip wheel -w {build_cache_dir} {build_dir}"
]
else:
cmd = [
"python setup.py build",
"python -mpip wheel -w {build_cache_dir} {build_dir}"
]
try:
import build
build_command = "python -m build"
except ImportError:
build_command = "python setup.py build"
cmd = [
build_command,
"python -mpip wheel -w {build_cache_dir} {build_dir}"
]

if cmd:
commit_name = repo.get_decorated_hash(commit_hash, 8)
Expand Down

0 comments on commit 5269845

Please sign in to comment.