Skip to content
This repository has been archived by the owner on Feb 26, 2019. It is now read-only.

Commit

Permalink
Merge pull request pypa#3 from DataDog/jaime/fixlogagain
Browse files Browse the repository at this point in the history
Revert "minor cleanup"
  • Loading branch information
truthbk committed Jun 7, 2018
2 parents b86ab17 + e3f9489 commit 4b191d5
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/pip/_internal/download.py
Expand Up @@ -74,7 +74,6 @@ def __init__(self, path_to_tuf_config_file):
function:
{
"enable_logging": true,
"repositories_dir": "repositories",
"repository_dir": "repository-name",
"target_path_patterns": ["^.*/(wheels/.*\\.whl)$"],
Expand All @@ -92,22 +91,27 @@ def __init__(self, path_to_tuf_config_file):
with open(path_to_tuf_config_file) as tuf_config_file:
tuf_config = json.load(tuf_config_file)

# NOTE: By default, we turn off TUF logging, and use the pip log
# instead.
tuf.settings.ENABLE_FILE_LOGGING = tuf_config.get('enable_logging',
False)
# Reconfigure TUF logging, we can use the pip log output
tuf.settings.ENABLE_FILE_LOGGING = tuf_config.get('enable_logging', False)

# NOTE: The directory where TUF metadata for *all* repositories are
# kept.
tuf.settings.repositories_directory = tuf_config['repositories_dir']
if os.path.isabs(tuf_config['repositories_dir']):
tuf.settings.repositories_directory = tuf_config['repositories_dir']
else:
tuf.settings.repositories_directory = os.path.join(
os.path.dirname(path_to_tuf_config_file),
tuf_config['repositories_dir']
)

# NOTE: Tell TUF where SSL certificates are kept.
tuf.settings.ssl_certificates = certifi.where()


# NOTE: The directory where the targets for *this* repository is
# cached. We hard-code this keep this to a subdirectory dedicated to
# this repository.
self.__targets_dir = os.path.join(tuf_config['repositories_dir'],
self.__targets_dir = os.path.join(tuf.settings.repositories_directory,
tuf_config['repository_dir'],
'targets')

Expand Down Expand Up @@ -170,6 +174,7 @@ def download(self, target_relpath, dest_dir, dest_filename):
if 'TUF_CONFIG_FILE' in os.environ:
import certifi
import tuf.settings
tuf.settings.ENABLE_FILE_LOGGING = False

from tuf.client.updater import Updater

Expand Down

0 comments on commit 4b191d5

Please sign in to comment.