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 b59dc42
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions asv/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -916,24 +916,19 @@ def _build_project(self, repo, commit_hash, build_dir):
"""
Run build commands
"""
build_dir_path = Path(build_dir)

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

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:
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 b59dc42

Please sign in to comment.