diff --git a/botocore/__init__.py b/botocore/__init__.py index 3b25e147f9..4f38682336 100644 --- a/botocore/__init__.py +++ b/botocore/__init__.py @@ -13,7 +13,6 @@ # language governing permissions and limitations under the License. import logging -import os import re __version__ = '1.26.2' @@ -60,8 +59,6 @@ def emit(self, record): # individual case. ScalarTypes = ('string', 'integer', 'boolean', 'timestamp', 'float', 'double') -BOTOCORE_ROOT = os.path.dirname(os.path.abspath(__file__)) - # Used to specify anonymous (unsigned) request signature class UNSIGNED: diff --git a/botocore/loaders.py b/botocore/loaders.py index 7952d03e88..c50a1b652f 100644 --- a/botocore/loaders.py +++ b/botocore/loaders.py @@ -104,7 +104,8 @@ import logging import os -from botocore import BOTOCORE_ROOT +import pkg_resources + from botocore.compat import HAS_GZIP, OrderedDict, json from botocore.exceptions import DataNotFoundError, UnknownServiceError from botocore.utils import deep_merge @@ -233,7 +234,7 @@ class Loader: FILE_LOADER_CLASS = JSONFileLoader # The included models in botocore/data/ that we ship with botocore. - BUILTIN_DATA_PATH = os.path.join(BOTOCORE_ROOT, 'data') + BUILTIN_DATA_PATH = pkg_resources.resource_filename('botocore', 'data') # For convenience we automatically add ~/.aws/models to the data path. CUSTOMER_DATA_PATH = os.path.join( os.path.expanduser('~'), '.aws', 'models' diff --git a/tests/functional/test_zip.py b/tests/functional/test_zip.py new file mode 100644 index 0000000000..20e0503863 --- /dev/null +++ b/tests/functional/test_zip.py @@ -0,0 +1,21 @@ +import os +import shutil +import sys +import tempfile + +from tests import BaseSessionTest + + +class ZipTest(BaseSessionTest): + def test_load_from_zip(self): + fd, temp_path = tempfile.mkstemp(suffix='.zip') + root, ext = os.path.splitext(temp_path) + shutil.make_archive(root, 'zip', '../..') + sys.path.insert(0, temp_path) + super(ZipTest, self).setUp() + self.region = 'us-west-2' + self.client = self.session.create_client( + 's3', self.region) + sys.path.remove(temp_path) + os.close(fd) + os.remove(temp_path)