File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -371,7 +371,8 @@ class Config:
371371 license : str
372372
373373 #: A string or list of strings specifying what other distributions need
374- #: to be installed when this one is.
374+ #: to be installed when this one is. If the requirement is ``==THIS_VERSION``,
375+ #: the requirement is set to be the same version as this package
375376 install_requires : List [str ]
376377
377378
Original file line number Diff line number Diff line change @@ -123,11 +123,23 @@ def prepare(self):
123123 # get_version expects the directory to exist
124124 base_package_path = self .base_package_path
125125 os .makedirs (base_package_path , exist_ok = True )
126- self . setup_kwargs [ "version" ] = get_version (
126+ this_version = get_version (
127127 write_to = join (base_package_path , "version.py" ),
128128 fallback_version = "master" ,
129129 search_parent_directories = True ,
130130 )
131+ self .setup_kwargs ["version" ] = this_version
132+
133+ # Support ==THIS_VERSION
134+ install_requires = self .setup_kwargs .get ("install_requires" )
135+ if install_requires :
136+
137+ def _xform (v : str ):
138+ if v .endswith ("==THIS_VERSION" ):
139+ v = f"{ v [:- 14 ]} =={ this_version } "
140+ return v
141+
142+ self .setup_kwargs ["install_requires" ] = list (map (_xform , install_requires ))
131143
132144 self .pkgcfg = PkgCfgProvider ()
133145
You can’t perform that action at this time.
0 commit comments