From e984029cd1988d9c660d46b51e866e0296ee227a Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Sat, 3 Mar 2018 17:32:21 +0100 Subject: Accept existing directory with no auto.conf in sync_deps() An initial empty auto.conf will be created, just as when sync_deps() creates the directory. This is more flexible. There's no good reason to require the directory to be created by sync_deps(). --- kconfiglib.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/kconfiglib.py b/kconfiglib.py index c5b0cdf..9b83070 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -972,13 +972,15 @@ class Kconfig(object): sync_deps(path) does the following: - 1. If the directory 'path' does not exist, it is created, and an - empty file auto.conf is stored in it. + 1. If the directory does not exist, it is created. + + 2. If no /auto.conf file exists, an initially empty auto.conf + is created. auto.conf keeps track of the old symbol values from the previous build. The format mirrors .config. - 2. auto.conf is loaded, and the old symbol values in it are compared + 3. auto.conf is loaded, and the old symbol values in it are compared against the current symbol values. If a symbol has changed value, the change is signaled by touch'ing a file corresponding to the symbol. @@ -992,7 +994,7 @@ class Kconfig(object): single directory with a huge number of files, which the underlying filesystem might not handle well. - 3. A new auto.conf is written to keep track of the current symbol + 4. A new auto.conf is written to keep track of the current symbol values for the next build. @@ -1011,7 +1013,10 @@ class Kconfig(object): implementation can be used as a template.""" if not os.path.exists(path): os.mkdir(path, 0o755) - open(os.path.join(path, "auto.conf"), "w").close() + + auto_conf = os.path.join(path, "auto.conf") + if not os.path.exists(auto_conf): + open(auto_conf, "w").close() # This setup makes sure that at least the current working directory # gets reset if things fail -- cgit v1.2.3