diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2012-12-04 14:47:06 +0100 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2012-12-04 14:47:06 +0100 |
| commit | 82ea79341694ba31d521dd670dccff24ead2ae1b (patch) | |
| tree | b0d7f952057078b8d34e9eb9e7e6389ae87008fb /kconfiglib.py | |
| parent | 95620c98f1a2f8ca416eca266463abb967f5a239 (diff) | |
Make $SRCARCH, $srctree, and the config filename queryable.
Thanks to fpemud for spotting this.
Diffstat (limited to 'kconfiglib.py')
| -rw-r--r-- | kconfiglib.py | 46 |
1 files changed, 34 insertions, 12 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index a6bbe5e..112acdc 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -496,8 +496,9 @@ class Config(): # default .config files self.defconfig_sym = None - # See Symbol.get_arch() - self.arch = os.environ.get("ARCH") + # See Symbol.get_(src)arch() + self.arch = os.environ.get("ARCH") + self.srcarch = os.environ.get("SRCARCH") # See Config.__init__(). We need this for get_defconfig_filename(). self.srctree = os.environ.get("srctree") @@ -701,12 +702,31 @@ class Config(): return self.filename def get_arch(self): - """Mostly Linux specific. Returns the value the environment variable - ARCH had at the time the Config instance was created, or None if ARCH - was not defined. This corresponds to the architecture, with values such - as "i386" or "mips".""" + """Returns the value the environment variable ARCH had at the time the + Config instance was created, or None if ARCH was not set. For the + kernel, this corresponds to the architecture being built for, with + values such as "i386" or "mips".""" return self.arch + def get_srcarch(self): + """Returns the value the environment variable SRCARCH had at the time + the Config instance was created, or None if SRCARCH was not set. For + the kernel, this corresponds to the arch/ subdirectory containing + architecture-specific source code.""" + return self.srcarch + + def get_srctree(self): + """Returns the value the environment variable srctree had at the time + the Config instance was created, or None if srctree was not defined. + This variable points to the source directory and is used when building + in a separate directory.""" + return self.srctree + + def get_config_filename(self): + """Returns the name of the most recently loaded configuration file, or + None if no configuration has been loaded.""" + return self.config_filename + def get_mainmenu_text(self): """Returns the text of the 'mainmenu' statement (with $-references to symbols replaced by symbol values), or None if the configuration has no @@ -877,15 +897,17 @@ class Config(): def __str__(self): """Returns a string containing various information about the Config.""" return _sep_lines("Configuration", - "File : " + self.filename, - "Base directory : " + self.base_dir, - "Arch (value of ARCH at time of creation) : " + self.arch, - "Most recently loaded .config : " + + "File : " + self.filename, + "Base directory : " + self.base_dir, + "Value of $ARCH at creation time : " + self.arch, + "Value of $SRCARCH at creation time : " + self.srcarch, + "Value of $srctree at creation time : " + self.srctree, + "Most recently loaded .config : " + ("(no .config loaded)" if self.config_filename is None else self.config_filename), - "Print warnings : " + + "Print warnings : " + bool_str[self.print_warnings], - "Print assignments to undefined symbols : " + + "Print assignments to undefined symbols : " + bool_str[self.print_undef_assign]) |
