Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[bundle:py2exe] Handle when CWD is not project root
Browse files Browse the repository at this point in the history
Authored by: bashonly
bashonly committed Mar 1, 2024

Verified

This commit was signed with the committer’s verified signature.
jeertmans Jérome Eertmans
1 parent de9821a commit b2d9c8e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions bundle/py2exe.py
Original file line number Diff line number Diff line change
@@ -4,7 +4,8 @@
import os
import sys

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, BASE_DIR)

import warnings

@@ -15,7 +16,7 @@
VERSION = read_version()


def main():
def _real_main():
warnings.warn(
'py2exe builds do not support pycryptodomex and needs VC++14 to run. '
'It is recommended to run "pyinst.py" to build using pyinstaller instead')
@@ -55,5 +56,14 @@ def main():
)


def main():
old_dir = os.getcwd()
os.chdir(BASE_DIR)
try:
_real_main()
finally:
os.chdir(old_dir)


if __name__ == '__main__':
main()

0 comments on commit b2d9c8e

Please sign in to comment.