forked from pypa/bandersnatch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide default values for mirror config options
This splits the existing 'default.conf' config file shipped with the package into two similar files: "defaults.conf" and "example.conf". "example.conf" is an exact copy of the previous "default.conf". The new "defaults.conf" is a stripped-down version containing only default values for all mirror configuration options except "mirror.directory". BandersnatchConfig is changed to *always* read defaults.conf, then read the user config file if one is specified. This leaves the ConfigParser populated with default values for any mirror options that aren't set by the user (except mirror.directory). Notable ripple effects for this include: - It is no longer meaningful to check ConfigParser.has_option with the 'mirror' section. Instead, you have to check whether the options value is empty or None. - Specifying a default/fallback value when calling .get on the 'mirror' section will have no effect, because the option will already be present in the ConfigParser mappings. As (mostly) an implementation detail, BandersnatchConfig is changed to be a subclass of ConfigParser. The BandersnatchConfig singleton can be used anywhere a ConfigParser instance is expected without having to use '.config' to access a nested ConfigParser. Fixes pypa#1702 Fixes pypa#990
- Loading branch information
1 parent
af92d2c
commit c2a0e47
Showing
17 changed files
with
264 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"""Exception subclasses for configuration file loading and validation.""" | ||
|
||
|
||
class ConfigError(Exception): | ||
"""Base exception for configuration file exceptions.""" | ||
|
||
pass | ||
|
||
|
||
class ConfigFileNotFound(ConfigError): | ||
"""A specified configuration file is missing or unreadable.""" | ||
|
||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
; [ Default Config Values ] | ||
; Bandersnatch loads this file prior to loading the user config file. | ||
; The values in this file serve as defaults and are overriden if also | ||
; specified in a user config. | ||
[mirror] | ||
storage-backend = filesystem | ||
|
||
master = https://pypi.org | ||
proxy = | ||
download-mirror = | ||
download-mirror-no-fallback = false | ||
|
||
json = false | ||
release-files = true | ||
hash-index = false | ||
simple-format = ALL | ||
compare-method = hash | ||
digest_name = sha256 | ||
keep-index-versions = 0 | ||
cleanup = false | ||
|
||
stop-on-error = false | ||
timeout = 10 | ||
global-timeout = 1800 | ||
workers = 3 | ||
verifiers = 3 | ||
|
||
; dynamic default: this URI used if `release-files = false` | ||
; root_uri = https://files.pythonhosted.org | ||
root_uri = | ||
diff-file = | ||
diff-append-epoch = false | ||
|
||
log-config = |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.