From 03bc3e667b5296892670a2ef54e285a108b264e7 Mon Sep 17 00:00:00 2001 From: Ashish Bhate Date: Thu, 19 Mar 2015 21:56:02 +0530 Subject: Convert absolute imports to relative imports. This helps in vendorizing. Except in scripts egg2wheel.py and wininst2wheel.py. --- wheel/bdist_wheel.py | 6 +++--- wheel/install.py | 12 ++++++------ wheel/metadata.py | 5 +++-- wheel/signatures/keys.py | 2 +- wheel/tool/__init__.py | 9 ++++----- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/wheel/bdist_wheel.py b/wheel/bdist_wheel.py index ac770e9..f84121a 100644 --- a/wheel/bdist_wheel.py +++ b/wheel/bdist_wheel.py @@ -11,7 +11,6 @@ import subprocess import warnings import shutil import json -import wheel try: import sysconfig @@ -39,6 +38,7 @@ from .archive import archive_wheelfile from .pkginfo import read_pkg_info, write_pkg_info from .metadata import pkginfo_to_dict from . import pep425tags, metadata +from . import __version__ as wheel_version def safer_name(name): return safe_name(name).replace('-', '_') @@ -251,7 +251,7 @@ class bdist_wheel(Command): else: rmtree(self.bdist_dir) - def write_wheelfile(self, wheelfile_base, generator='bdist_wheel (' + wheel.__version__ + ')'): + def write_wheelfile(self, wheelfile_base, generator='bdist_wheel (' + wheel_version + ')'): from email.message import Message msg = Message() msg['Wheel-Version'] = '1.0' # of the spec @@ -415,7 +415,7 @@ class bdist_wheel(Command): adios(egginfo_path) def write_record(self, bdist_dir, distinfo_dir): - from wheel.util import urlsafe_b64encode + from .util import urlsafe_b64encode record_path = os.path.join(distinfo_dir, 'RECORD') record_relpath = os.path.relpath(record_path, bdist_dir) diff --git a/wheel/install.py b/wheel/install.py index 3af6d0c..95a9679 100644 --- a/wheel/install.py +++ b/wheel/install.py @@ -18,12 +18,12 @@ try: except NameError: _big_number = sys.maxint -from wheel.decorator import reify -from wheel.util import (urlsafe_b64encode, from_json, urlsafe_b64decode, - native, binary, HashingFile) -from wheel import signatures -from wheel.pkginfo import read_pkg_info_bytes -from wheel.util import open_for_csv +from .decorator import reify +from .util import (urlsafe_b64encode, from_json, urlsafe_b64decode, + native, binary, HashingFile) +from . import signatures +from .pkginfo import read_pkg_info_bytes +from .util import open_for_csv from .pep425tags import get_supported from .paths import get_install_paths diff --git a/wheel/metadata.py b/wheel/metadata.py index 02c0663..9d81a16 100644 --- a/wheel/metadata.py +++ b/wheel/metadata.py @@ -15,7 +15,8 @@ import os.path import textwrap import pkg_resources import email.parser -import wheel + +from . import __version__ as wheel_version METADATA_VERSION = "2.0" @@ -99,7 +100,7 @@ def pkginfo_to_dict(path, distribution=None): """ metadata = OrderedDefaultDict(lambda: OrderedDefaultDict(lambda: OrderedDefaultDict(OrderedDict))) - metadata["generator"] = "bdist_wheel (" + wheel.__version__ + ")" + metadata["generator"] = "bdist_wheel (" + wheel_version + ")" try: unicode pkg_info = read_pkg_info(path) diff --git a/wheel/signatures/keys.py b/wheel/signatures/keys.py index 1dde4bf..57d7feb 100644 --- a/wheel/signatures/keys.py +++ b/wheel/signatures/keys.py @@ -33,7 +33,7 @@ wheel export key import json import os.path -from wheel.util import native, load_config_paths, save_config_path +from ..util import native, load_config_paths, save_config_path class WheelKeys(object): SCHEMA = 1 diff --git a/wheel/tool/__init__.py b/wheel/tool/__init__.py index a997d1f..61f6627 100644 --- a/wheel/tool/__init__.py +++ b/wheel/tool/__init__.py @@ -6,13 +6,13 @@ import os import hashlib import sys import json -import wheel.paths from glob import iglob from .. import signatures from ..util import (urlsafe_b64decode, urlsafe_b64encode, native, binary, matches_requirement) -from ..install import WheelFile +from ..install import WheelFile, VerifyingZipFile +from ..paths import get_install_command def require_pkgresources(name): try: @@ -99,8 +99,7 @@ def unsign(wheelfile): ordinary archive, with the compressed files and the directory in the same order, and without any non-zip content after the truncation point. """ - import wheel.install - vzf = wheel.install.VerifyingZipFile(wheelfile, "a") + vzf = VerifyingZipFile(wheelfile, "a") info = vzf.infolist() if not (len(info) and info[-1].filename.endswith('/RECORD.jws')): raise WheelError("RECORD.jws not found at end of archive.") @@ -235,7 +234,7 @@ def install_scripts(distributions): for dist in distributions: pkg_resources_dist = pkg_resources.get_distribution(dist) - install = wheel.paths.get_install_command(dist) + install = get_install_command(dist) command = easy_install.easy_install(install.distribution) command.args = ['wheel'] # dummy argument command.finalize_options() -- cgit v1.2.1