Skip to content

Commit

Permalink
fix(dmg-builder): the "import" unbound issue for python 2/3 (#6672)
Browse files Browse the repository at this point in the history
  • Loading branch information
pan93412 authored Feb 25, 2022
1 parent e1a439b commit 3a4b64a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/cold-crabs-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"dmg-builder": patch
---

fix(dmg-builder): the "import" unbound issue
17 changes: 10 additions & 7 deletions packages/dmg-builder/vendor/dmgbuild/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__), "..")))

Expand Down Expand Up @@ -284,4 +287,4 @@ def build_dmg():
except:
raise

build_dmg()
build_dmg()

0 comments on commit 3a4b64a

Please sign in to comment.