mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-10 20:32:12 +03:00
EDMarketConnector: Improve 'develop only for devs' check
* Move it later, after CLI args processing. This would allow for a magic 'override' this, providing a key or similar. * Correct text 'XAthan' to 'Athan' in 'win32' check. * If `git_branch != 'develop'` check if `-alpha0` is in the app version. Such version strings are never in any pre-release or release.
This commit is contained in:
parent
0d65adb77e
commit
0523e2289a
@ -49,39 +49,6 @@ if __name__ == '__main__':
|
|||||||
sys.stdout = sys.stderr = open(join(tempfile.gettempdir(), f'{appname}.log'), mode='wt', buffering=1)
|
sys.stdout = sys.stderr = open(join(tempfile.gettempdir(), f'{appname}.log'), mode='wt', buffering=1)
|
||||||
# TODO: Test: Make *sure* this redirect is working, else py2exe is going to cause an exit popup
|
# TODO: Test: Make *sure* this redirect is working, else py2exe is going to cause an exit popup
|
||||||
|
|
||||||
try:
|
|
||||||
import subprocess
|
|
||||||
git_cmd = subprocess.Popen('git branch --show-current'.split(),
|
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.STDOUT
|
|
||||||
)
|
|
||||||
out, err = git_cmd.communicate()
|
|
||||||
git_branch = out.decode().rstrip('\n')
|
|
||||||
|
|
||||||
if (
|
|
||||||
git_branch == 'develop'
|
|
||||||
and (
|
|
||||||
(
|
|
||||||
sys.platform == 'linux'
|
|
||||||
and environ.get('USER') is not None
|
|
||||||
and environ['USER'] not in ['ad', 'athan']
|
|
||||||
)
|
|
||||||
or (
|
|
||||||
sys.platform == 'win32'
|
|
||||||
and environ.get('USERNAME') is not None
|
|
||||||
and environ['USERNAME'] not in ['XAthan']
|
|
||||||
)
|
|
||||||
)
|
|
||||||
):
|
|
||||||
print("Why are you running the develop branch if you're not a developer?")
|
|
||||||
print("Please check https://github.com/EDCD/EDMarketConnector/wiki/Running-from-source#running-from-source")
|
|
||||||
print("You probably want the 'stable' branch.")
|
|
||||||
print("\n\rIf Athanasius or A_D asked you to run this, tell them about this message.")
|
|
||||||
sys.exit(-1)
|
|
||||||
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
# These need to be after the stdout/err redirect because they will cause
|
# These need to be after the stdout/err redirect because they will cause
|
||||||
# logging to be set up.
|
# logging to be set up.
|
||||||
@ -399,6 +366,42 @@ if __name__ == '__main__': # noqa: C901
|
|||||||
sys.stdout.seek(0)
|
sys.stdout.seek(0)
|
||||||
sys.stdout.truncate()
|
sys.stdout.truncate()
|
||||||
|
|
||||||
|
git_branch = ""
|
||||||
|
try:
|
||||||
|
import subprocess
|
||||||
|
git_cmd = subprocess.Popen('git branch --show-current'.split(),
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.STDOUT
|
||||||
|
)
|
||||||
|
out, err = git_cmd.communicate()
|
||||||
|
git_branch = out.decode().rstrip('\n')
|
||||||
|
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if (
|
||||||
|
(
|
||||||
|
git_branch == 'develop'
|
||||||
|
or '-alpha0' in str(appversion())
|
||||||
|
) and (
|
||||||
|
(
|
||||||
|
sys.platform == 'linux'
|
||||||
|
and environ.get('USER') is not None
|
||||||
|
and environ['USER'] not in ['ad', 'athan']
|
||||||
|
)
|
||||||
|
or (
|
||||||
|
sys.platform == 'win32'
|
||||||
|
and environ.get('USERNAME') is not None
|
||||||
|
and environ['USERNAME'] not in ['Athan']
|
||||||
|
)
|
||||||
|
)
|
||||||
|
):
|
||||||
|
print("Why are you running the develop branch if you're not a developer?")
|
||||||
|
print("Please check https://github.com/EDCD/EDMarketConnector/wiki/Running-from-source#running-from-source")
|
||||||
|
print("You probably want the 'stable' branch.")
|
||||||
|
print("\n\rIf Athanasius or A_D asked you to run this, tell them about this message.")
|
||||||
|
sys.exit(-1)
|
||||||
|
|
||||||
|
|
||||||
# See EDMCLogging.py docs.
|
# See EDMCLogging.py docs.
|
||||||
# isort: off
|
# isort: off
|
||||||
|
Loading…
x
Reference in New Issue
Block a user