Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

Commit

Permalink
Always unload pkg_resources in bundle context manager
Browse files Browse the repository at this point in the history
  • Loading branch information
zrzka committed Jan 11, 2018
1 parent 7a07ff3 commit f89eba2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
* `blackmamba.uikit.keyboard`
* Camel case enum constant deprecated, will be removed in 2.0.0
* Use UPPER_CASED versions, camel case still exists as aliases
* `with bundle()` always unloads `pkg_resources.*` causing issues
* Launch Pythonista, run Black Mamba Analyze - works vs
* Launch Pythonista, run Pythonista unit tests, run Black Mamba Analyze - fails, because of `pkg_resources`

## 1.4.3 (2017-12-30)

Expand Down
7 changes: 7 additions & 0 deletions blackmamba/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
'refactoring': ['rope', 'future', 'libfuturize', 'libpasteurize']
}

_ALWAYS_UNLOAD = [
'pkg_resources'
]

_BUNDLED_MODULES_PATH = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib'))


Expand Down Expand Up @@ -63,6 +67,9 @@ def unload(name):

@contextmanager
def bundle(name, unload_bundle=False):
for module in _ALWAYS_UNLOAD:
_unload_modules(module)

load(name)
yield name
if unload_bundle:
Expand Down

0 comments on commit f89eba2

Please sign in to comment.