Source: cookiecutter Version: 1.4.0-2 Severity: wishlist Tags: patch User: reproducible-bui...@lists.alioth.debian.org Usertags: environment X-Debbugs-Cc: reproducible-bui...@lists.alioth.debian.org
Hi, Whilst working on the Reproducible Builds effort [0], I noticed that cookiecutter could not be built reproducibly. Patch attached. [0] https://reproducible-builds.org/ Regards, -- ,''`. : :' : Chris Lamb `. `'` la...@debian.org / chris-lamb.co.uk `-
--- a/debian/patches/0003-Reproducible-build.patch 1970-01-01 01:00:00.000000000 +0100 --- b/debian/patches/0003-Reproducible-build.patch 2016-08-19 23:59:45.688697595 +0100 @@ -0,0 +1,54 @@ +Description: Make the build reproducible +Author: Chris Lamb <la...@debian.org> +Last-Update: 2016-08-19 + +--- cookiecutter-1.4.0.orig/cookiecutter/config.py ++++ cookiecutter-1.4.0/cookiecutter/config.py +@@ -22,6 +22,7 @@ from .exceptions import InvalidConfigura + + logger = logging.getLogger(__name__) + ++NOT_PROVIDED = object() + USER_CONFIG_PATH = os.path.expanduser('~/.cookiecutterrc') + + DEFAULT_CONFIG = { +@@ -68,7 +69,7 @@ def get_config(config_path): + return config_dict + + +-def get_user_config(config_file=USER_CONFIG_PATH): ++def get_user_config(config_file=NOT_PROVIDED): + """Retrieve the config from a file or return the defaults if None is + passed. If an environment variable `COOKIECUTTER_CONFIG` is set up, try + to load its value. Otherwise fall back to a default file or config. +@@ -77,6 +78,10 @@ def get_user_config(config_file=USER_CON + if config_file is None: + return copy.copy(DEFAULT_CONFIG) + ++ # Differentiate between being passed ``None`` and the default. ++ if config_file is NOT_PROVIDED: ++ config_file = USER_CONFIG_PATH ++ + # Load the given config file + if config_file and config_file is not USER_CONFIG_PATH: + return get_config(config_file) +--- cookiecutter-1.4.0.orig/cookiecutter/main.py ++++ cookiecutter-1.4.0/cookiecutter/main.py +@@ -16,7 +16,7 @@ import logging + import os + import re + +-from .config import get_user_config, USER_CONFIG_PATH ++from .config import get_user_config, NOT_PROVIDED + from .exceptions import InvalidModeException, RepositoryNotFound + from .prompt import prompt_for_config + from .generate import generate_context, generate_files +@@ -71,7 +71,7 @@ def expand_abbreviations(template, confi + def cookiecutter( + template, checkout=None, no_input=False, extra_context=None, + replay=False, overwrite_if_exists=False, output_dir='.', +- config_file=USER_CONFIG_PATH): ++ config_file=NOT_PROVIDED): + """ + API equivalent to using Cookiecutter at the command line. + --- a/debian/patches/series 2016-08-19 23:41:14.643167381 +0100 --- b/debian/patches/series 2016-08-19 23:50:49.588100239 +0100 @@ -1,2 +1,3 @@ 0001-Don-t-test-for-.DS_Store.patch 0002-Use-PyYAML-instead-of-poyo.patch +0003-Reproducible-build.patch