From e5e8a724562f78d47f2927fe6e0f0e5cd0fa8a02 Mon Sep 17 00:00:00 2001 From: pan93412 Date: Thu, 24 Feb 2022 13:40:07 +0800 Subject: [PATCH] fix(dmg-builder): the "import" unbound issue --- .changeset/cold-crabs-destroy.md | 5 +++++ packages/dmg-builder/vendor/dmgbuild/core.py | 17 ++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 .changeset/cold-crabs-destroy.md diff --git a/.changeset/cold-crabs-destroy.md b/.changeset/cold-crabs-destroy.md new file mode 100644 index 00000000000..5a5fa4a6585 --- /dev/null +++ b/.changeset/cold-crabs-destroy.md @@ -0,0 +1,5 @@ +--- +"dmg-builder": patch +--- + +fix(dmg-builder): the "import" unbound issue diff --git a/packages/dmg-builder/vendor/dmgbuild/core.py b/packages/dmg-builder/vendor/dmgbuild/core.py index 8154acbffbf..1adc35289fc 100644 --- a/packages/dmg-builder/vendor/dmgbuild/core.py +++ b/packages/dmg-builder/vendor/dmgbuild/core.py @@ -4,13 +4,16 @@ import os import re import sys + if sys.version_info.major == 3: - try: - from importlib import reload - except ImportError: - from imp import reload -reload(sys) # Reload is a hack -sys.setdefaultencoding('UTF8') + try: + from importlib import reload + except ImportError: + from imp import reload + reload(sys) # To workaround the unbound issue +else: + reload(sys) # Reload is a hack + sys.setdefaultencoding('UTF8') sys.path.append(os.path.normpath(os.path.join(os.path.dirname(__file__), ".."))) @@ -284,4 +287,4 @@ def build_dmg(): except: raise -build_dmg() \ No newline at end of file +build_dmg()