mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 08:35:21 +00:00
Allow writing Salt's _version.py when installing in develop mode.
Pass `--write-salt-version` or set the `WRITE_SALT_VERSION` environment variable to trigger the generation of `_version.py`. Closes #25094
This commit is contained in:
parent
71928f2194
commit
26246a72ee
22
setup.py
22
setup.py
@ -201,6 +201,24 @@ class WriteSaltSshPackagingFile(Command):
|
||||
|
||||
if WITH_SETUPTOOLS:
|
||||
class Develop(develop):
|
||||
user_options = develop.user_options + [
|
||||
('write-salt-version', None,
|
||||
'Generate Salt\'s _version.py file which allows proper version '
|
||||
'reporting. This defaults to False on develop/editable setups.')
|
||||
]
|
||||
boolean_options = develop.boolean_options + [
|
||||
'write-salt-version'
|
||||
]
|
||||
|
||||
def initialize_options(self):
|
||||
develop.initialize_options(self)
|
||||
self.write_salt_version = False
|
||||
|
||||
def finalize_options(self):
|
||||
develop.finalize_options(self)
|
||||
if 'WRITE_SALT_VERSION' in os.environ:
|
||||
self.write_salt_version = True
|
||||
|
||||
def run(self):
|
||||
if IS_WINDOWS_PLATFORM:
|
||||
if __saltstack_version__.info < (2015, 8): # pylint: disable=undefined-variable
|
||||
@ -218,6 +236,10 @@ if WITH_SETUPTOOLS:
|
||||
self.distribution.salt_download_windows_dlls = True
|
||||
self.run_command('download-windows-dlls')
|
||||
self.distribution.salt_download_windows_dlls = None
|
||||
|
||||
if self.write_salt_version is True:
|
||||
self.distribution.salt_version_hardcoded_path = SALT_VERSION_HARDCODED
|
||||
self.run_command('write-salt-version')
|
||||
develop.run(self)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user