Skip to content

Commit

Permalink
fix(build): support pyproject version (#1502)
Browse files Browse the repository at this point in the history
* fix(build): support pyproject version

* refactor: use util for parsing pyproject

---------

Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
  • Loading branch information
blaggacao and ankush committed Feb 23, 2024
1 parent 26e1f10 commit 7c64aa3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions bench/utils/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def get_app_name(bench_path: str, folder_name: str) -> str:

config_py_path = os.path.join(apps_path, folder_name, "setup.cfg")
setup_py_path = os.path.join(apps_path, folder_name, "setup.py")

pyproject_path = os.path.join(apps_path, folder_name, "pyproject.toml")
pyproject = get_pyproject(pyproject_path)
if pyproject:
Expand Down Expand Up @@ -278,12 +278,17 @@ def check_existing_dir(bench_path, repo_name):
def get_current_version(app, bench_path="."):
current_version = None
repo_dir = get_repo_dir(app, bench_path=bench_path)
pyproject_path = os.path.join(repo_dir, "pyproject.toml")
config_path = os.path.join(repo_dir, "setup.cfg")
init_path = os.path.join(repo_dir, os.path.basename(repo_dir), "__init__.py")
setup_path = os.path.join(repo_dir, "setup.py")

try:
if os.path.exists(config_path):
pyproject = get_pyproject(pyproject_path)
if pyproject:
current_version = pyproject.get("project", {}).get("version")

if not current_version and os.path.exists(config_path):
from setuptools.config import read_configuration

config = read_configuration(config_path)
Expand Down

0 comments on commit 7c64aa3

Please sign in to comment.