]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
Revert "Merge pull request #505 from wodo/pi_support" 533/head
authorJakob Schnitzer <mail@jakobschnitzer.de>
Thu, 28 Sep 2017 17:18:32 +0000 (19:18 +0200)
committerJakob Schnitzer <mail@jakobschnitzer.de>
Thu, 28 Sep 2017 17:18:32 +0000 (19:18 +0200)
This reverts commit 653e6d4f654f0f3cbce57054654e09c519b9e412, reversing
changes made to 5f3b00854bbc6fa6a03e04ab572a609eebcc1f72.

babel/core.py
babel/localedata.py
tests/test_localedata.py

index df03b24adac75ff728e3f5b984b3fac8c5d3b043..5140f49d79b80dc6c16995fff5a56a726bf2cf31 100644 (file)
@@ -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()
index ae21547812b0404e22f2ea9ff0b0b74c66cb4a5f..0c94e49ea98debb04dd22ec946586252f90279f9 100644 (file)
@@ -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):
index 3599b2157d4de976bdaddb519349b830da492c44..6954d3886445ddaf81f4deadce515ef574391943 100644 (file)
@@ -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)