Skip to content

Commit

Permalink
Add support for setting dependency version to same version as self
Browse files Browse the repository at this point in the history
  • Loading branch information
virtuald committed Dec 16, 2023
1 parent 0be35e3 commit 46c5d1e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion robotpy_build/config/pyproject_toml.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,8 @@ class Config:
license: str

#: A string or list of strings specifying what other distributions need
#: to be installed when this one is.
#: to be installed when this one is. If the requirement is ``==THIS_VERSION``,
#: the requirement is set to be the same version as this package
install_requires: List[str]


Expand Down
14 changes: 13 additions & 1 deletion robotpy_build/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,23 @@ def prepare(self):
# get_version expects the directory to exist
base_package_path = self.base_package_path
os.makedirs(base_package_path, exist_ok=True)
self.setup_kwargs["version"] = get_version(
this_version = get_version(
write_to=join(base_package_path, "version.py"),
fallback_version="master",
search_parent_directories=True,
)
self.setup_kwargs["version"] = this_version

# Support ==THIS_VERSION
install_requires = self.setup_kwargs.get("install_requires")
if install_requires:

def _xform(v: str):
if v.endswith("==THIS_VERSION"):
v = f"{v[:-14]}=={this_version}"
return v

self.setup_kwargs["install_requires"] = list(map(_xform, install_requires))

self.pkgcfg = PkgCfgProvider()

Expand Down

0 comments on commit 46c5d1e

Please sign in to comment.