summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Schnitzer <mail@jakobschnitzer.de>2017-09-28 19:18:32 +0200
committerJakob Schnitzer <mail@jakobschnitzer.de>2017-09-28 19:18:32 +0200
commit29da2d2d47b43dd71e5b696cb6b9cca90b4446c2 (patch)
tree489fe89e8a776353207243673a18102837e87102
parent7cedb84c7fd29ccb765aa9e408fcdd23bce2af06 (diff)
downloadbabel-29da2d2d47b43dd71e5b696cb6b9cca90b4446c2.tar.gz
Revert "Merge pull request #505 from wodo/pi_support"
This reverts commit 653e6d4f654f0f3cbce57054654e09c519b9e412, reversing changes made to 5f3b00854bbc6fa6a03e04ab572a609eebcc1f72.
-rw-r--r--babel/core.py2
-rw-r--r--babel/localedata.py12
-rw-r--r--tests/test_localedata.py12
3 files changed, 2 insertions, 24 deletions
diff --git a/babel/core.py b/babel/core.py
index df03b24..5140f49 100644
--- a/babel/core.py
+++ b/babel/core.py
@@ -68,7 +68,7 @@ def get_global(key):
"""
global _global_data
if _global_data is None:
- dirname = localedata.get_base_dir()
+ dirname = os.path.join(os.path.dirname(__file__))
filename = os.path.join(dirname, 'global.dat')
if not os.path.isfile(filename):
_raise_no_data_error()
diff --git a/babel/localedata.py b/babel/localedata.py
index ae21547..0c94e49 100644
--- a/babel/localedata.py
+++ b/babel/localedata.py
@@ -16,23 +16,13 @@ import os
import threading
from collections import MutableMapping
from itertools import chain
-import sys
from babel._compat import pickle, string_types
-def get_base_dir():
- if getattr(sys, 'frozen', False):
- # we are running in a |PyInstaller| bundle
- basedir = sys._MEIPASS
- else:
- # we are running in a normal Python environment
- basedir = os.path.dirname(__file__)
- return basedir
-
_cache = {}
_cache_lock = threading.RLock()
-_dirname = os.path.join(get_base_dir(), 'locale-data')
+_dirname = os.path.join(os.path.dirname(__file__), 'locale-data')
def normalize_locale(name):
diff --git a/tests/test_localedata.py b/tests/test_localedata.py
index 3599b21..6954d38 100644
--- a/tests/test_localedata.py
+++ b/tests/test_localedata.py
@@ -14,7 +14,6 @@
import unittest
import random
from operator import methodcaller
-import sys
from babel import localedata, numbers
@@ -94,17 +93,6 @@ def test_mixedcased_locale():
methodcaller(random.choice(['lower', 'upper']))(c) for c in l])
assert localedata.exists(locale_id)
-
-def test_pi_support_frozen(monkeypatch):
- monkeypatch.setattr(sys, '_MEIPASS', 'testdir', raising=False)
- monkeypatch.setattr(sys, 'frozen', True, raising=False)
- assert localedata.get_base_dir() == 'testdir'
-
-
-def test_pi_support_not_frozen():
- assert not getattr(sys, 'frozen', False)
- assert localedata.get_base_dir().endswith('babel')
-
def test_locale_argument_acceptance():
# Testing None input.
normalized_locale = localedata.normalize_locale(None)