diff --git a/robotpy_build/config/pyproject_toml.py b/robotpy_build/config/pyproject_toml.py index afd3707f..dff02090 100644 --- a/robotpy_build/config/pyproject_toml.py +++ b/robotpy_build/config/pyproject_toml.py @@ -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] diff --git a/robotpy_build/setup.py b/robotpy_build/setup.py index b0dd1d24..c1bbe022 100644 --- a/robotpy_build/setup.py +++ b/robotpy_build/setup.py @@ -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()