mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Better exec()
detection. Avoids esky build NameError
.
This commit is contained in:
parent
cfa3ba3d48
commit
99148a1380
2 changed files with 9 additions and 15 deletions
|
@ -358,25 +358,17 @@ def __get_version(version, version_info):
|
||||||
import warnings
|
import warnings
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
try:
|
if 'SETUP_DIRNAME' in globals():
|
||||||
cwd = os.path.abspath(os.path.dirname(__file__))
|
|
||||||
except NameError:
|
|
||||||
# We're most likely being frozen and __file__ triggered this NameError
|
|
||||||
# Let's work around that
|
|
||||||
import inspect
|
|
||||||
cwd = os.path.abspath(
|
|
||||||
os.path.dirname(inspect.getsourcefile(__get_version))
|
|
||||||
)
|
|
||||||
|
|
||||||
if __file__ == 'setup.py':
|
|
||||||
# This is from the exec() call in Salt's setup.py
|
# This is from the exec() call in Salt's setup.py
|
||||||
|
cwd = SETUP_DIRNAME # pylint: disable=E0602
|
||||||
if not os.path.exists(os.path.join(cwd, '.git')):
|
if not os.path.exists(os.path.join(cwd, '.git')):
|
||||||
# This is not a Salt git checkout!!! Don't even try to parse...
|
# This is not a Salt git checkout!!! Don't even try to parse...
|
||||||
return version, version_info
|
return version, version_info
|
||||||
|
else:
|
||||||
elif not os.path.exists(os.path.join(os.path.dirname(cwd), '.git')):
|
cwd = os.path.abspath(os.path.dirname(__file__))
|
||||||
# This is not a Salt git checkout!!! Don't even try to parse...
|
if not os.path.exists(os.path.join(os.path.dirname(cwd), '.git')):
|
||||||
return version, version_info
|
# This is not a Salt git checkout!!! Don't even try to parse...
|
||||||
|
return version, version_info
|
||||||
|
|
||||||
try:
|
try:
|
||||||
kwargs = dict(
|
kwargs = dict(
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -33,6 +33,8 @@ except NameError:
|
||||||
if SETUP_DIRNAME != '':
|
if SETUP_DIRNAME != '':
|
||||||
os.chdir(SETUP_DIRNAME)
|
os.chdir(SETUP_DIRNAME)
|
||||||
|
|
||||||
|
SETUP_DIRNAME = os.path.abspath(SETUP_DIRNAME)
|
||||||
|
|
||||||
BOOTSTRAP_SCRIPT_DISTRIBUTED_VERSION = os.environ.get(
|
BOOTSTRAP_SCRIPT_DISTRIBUTED_VERSION = os.environ.get(
|
||||||
# The user can provide a different bootstrap-script version.
|
# The user can provide a different bootstrap-script version.
|
||||||
# ATTENTION: A tag for that version MUST exist
|
# ATTENTION: A tag for that version MUST exist
|
||||||
|
|
Loading…
Add table
Reference in a new issue