Skip to content

Commit 1f83a90

Browse files
Fix pip install from git repo
1 parent c69d1a1 commit 1f83a90

3 files changed

Lines changed: 38 additions & 2 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""Version scheme for setuptools-scm - creates post-release versions."""
2+
from setuptools_scm.version import guess_next_version
3+
4+
5+
def post_version(version):
6+
"""Create post-release versions instead of dev versions."""
7+
if version.exact:
8+
return version.format_with("{tag}").lstrip('v')
9+
10+
base = str(version.tag).lstrip('v') if version.tag else (guess_next_version(version) or "1.0")
11+
distance = version.distance or 0
12+
13+
return f"{base}.{distance}" if distance > 0 else base
14+
15+
16+
def no_local(version):
17+
"""No local version identifier."""
18+
return ""

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ include-package-data = true
3030
[tool.setuptools_scm]
3131
write_to = "hwcomponents_library/_version.py"
3232
fallback_version = "1.0"
33-
version_scheme = "setup_scm_version:post_version"
34-
local_scheme = "setup_scm_version:no_local"
33+
version_scheme = "hwcomponents._version_scheme:post_version"
34+
local_scheme = "hwcomponents._version_scheme:no_local"

setup.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""Setup.py to ensure hwcomponents._version_scheme is importable during build."""
2+
import sys
3+
from pathlib import Path
4+
5+
# Add paths to ensure hwcomponents can be imported
6+
current_dir = Path(__file__).parent.absolute()
7+
if str(current_dir) not in sys.path:
8+
sys.path.insert(0, str(current_dir))
9+
10+
# Try to find hwcomponents in parent directories (for submodule case)
11+
parent_dir = current_dir.parent.parent
12+
hwcomponents_dir = parent_dir / "hwcomponents"
13+
if hwcomponents_dir.exists() and str(parent_dir) not in sys.path:
14+
sys.path.insert(0, str(parent_dir))
15+
16+
from setuptools import setup
17+
18+
setup()

0 commit comments

Comments
 (0)