Debian Codegraph @

debian/patches/reproducible-config-autofunction.patch

raw
1 Author: Diane Trout <[email protected]>
2 Forwarded: no
3 Description: Call os.path.expanduser in the collect function instead of top level
4 Calling it when defining the PATH or paths variables meant the
5 value of os.path.expanduser("~") ended up as part of the default
6 function signature, which makes this unreproducible.
7 Also I think ~ is a bit clearer to the user, at least Unix-like OS users.
8 --- dask.orig/dask/config.py
9 +++ dask/dask/config.py
10 @@ -28,7 +28,7 @@
11 os.getenv("DASK_ROOT_CONFIG", "/etc/dask"),
12 os.path.join(sys.prefix, "etc", "dask"),
13 *[os.path.join(prefix, "etc", "dask") for prefix in site.PREFIXES],
14 - os.path.join(os.path.expanduser("~"), ".config", "dask"),
15 + os.path.join("~", ".config", "dask"),
16 ]
17 if "DASK_CONFIG" in os.environ:
18 paths.append(os.environ["DASK_CONFIG"])
19 @@ -44,7 +44,7 @@
20 if "DASK_CONFIG" in os.environ:
21 PATH = os.environ["DASK_CONFIG"]
22 else:
23 - PATH = os.path.join(os.path.expanduser("~"), ".config", "dask")
24 + PATH = os.path.join("~", ".config", "dask")
25
26
27 config: dict = {}
28 @@ -218,6 +218,7 @@
29 # Find all paths
30 file_paths = []
31 for path in paths:
32 + path = os.path.expanduser(path)
33 if os.path.exists(path):
34 if os.path.isdir(path):
35 try:
36 @@ -331,7 +332,7 @@
37 Whether or not to comment out the config file when copying.
38 """
39 if destination is None:
40 - destination = PATH
41 + destination = os.path.expanduser(PATH)
42
43 # destination is a file and already exists, never overwrite
44 if os.path.isfile(destination):
45 --- dask.orig/dask/tests/test_config.py
46 +++ dask/dask/tests/test_config.py
47 @@ -652,7 +652,7 @@
48 expected = [
49 "/etc/dask",
50 os.path.join(sys.prefix, "etc", "dask"),
51 - os.path.join(os.path.expanduser("~"), ".config", "dask"),
52 + os.path.join("~", ".config", "dask"),
53 ]
54 paths = _get_paths()
55 assert paths == expected