App: Cosmetics: Replace double by single quotes

Replace " by ' where applicable for consistency.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-04-21 10:32:31 +02:00
commit dacea3a104
Signed by: jan
GPG key ID: 3750640C9E25DD61

View file

@ -55,7 +55,7 @@ class ResultCache(object):
return r return r
d = d[k] = {} d = d[k] = {}
#d = d[k] #d = d[k]
raise Exception("cache algorithm failed for function", func.__name__, "in depth", depth) raise Exception('cache algorithm failed for function', func.__name__, 'in depth', depth)
class Scope(Enum): class Scope(Enum):
Self = auto() Self = auto()
@ -142,7 +142,7 @@ class App(Base):
return return
visited.add(spec) visited.add(spec)
deps = self.get_value(name, section, key) deps = self.get_value(name, section, key)
log(DEBUG, "name = ", name, "section = ", section, "key = ", key, "deps = ", deps, "scope = ", scope.name, "visited = ", visited) log(DEBUG, 'name = ', name, 'section = ', section, 'key = ', key, 'deps = ', deps, 'scope = ', scope.name, 'visited = ', visited)
if deps and scope != Scope.Self: if deps and scope != Scope.Self:
if scope == Scope.One: if scope == Scope.One:
subscope = Scope.Self subscope = Scope.Self
@ -213,7 +213,7 @@ class App(Base):
def __init__(self, distro: Distro|None=None) -> None: def __init__(self, distro: Distro|None=None) -> None:
super().__init__("jw-pkg swiss army knife", modules=["jw.pkg.cmds"]) super().__init__('jw-pkg swiss army knife', modules=['jw.pkg.cmds'])
# -- Members without default values # -- Members without default values
self.__opt_interactive: bool|None = None self.__opt_interactive: bool|None = None
@ -227,7 +227,7 @@ class App(Base):
# -- Members with default values # -- Members with default values
self.__topdir_fmt = 'absolute' self.__topdir_fmt = 'absolute'
self.__projs_root = pwd.getpwuid(os.getuid()).pw_dir + "/local/src/jw.dev/proj" self.__projs_root = pwd.getpwuid(os.getuid()).pw_dir + '/local/src/jw.dev/proj'
self.__pretty_projs_root = None self.__pretty_projs_root = None
async def __init_async(self) -> None: async def __init_async(self) -> None:
@ -248,9 +248,9 @@ class App(Base):
parser.add_argument('-p', '--prefix', default = None, parser.add_argument('-p', '--prefix', default = None,
help='Parent directory of project source directories') help='Parent directory of project source directories')
parser.add_argument('--distro-id', default=None, help='Distribution ID (default is taken from /etc/os-release)') parser.add_argument('--distro-id', default=None, help='Distribution ID (default is taken from /etc/os-release)')
parser.add_argument('--interactive', choices=['true', 'false', 'auto'], default='true', help="Wait for user input or try to proceed unattended") parser.add_argument('--interactive', choices=['true', 'false', 'auto'], default='true', help='Wait for user input or try to proceed unattended')
parser.add_argument('--verbose', action='store_true', default=False, help="Be verbose on stderr about what's being done on the distro level") parser.add_argument('--verbose', action='store_true', default=False, help='Be verbose on stderr about what\'s being done on the distro level')
parser.add_argument('--uri', default='local', help="Run commands on this host") parser.add_argument('--uri', default='local', help='Run commands on this host')
async def _run(self, args: argparse.Namespace) -> None: async def _run(self, args: argparse.Namespace) -> None:
self.__topdir = args.topdir self.__topdir = args.topdir
@ -311,12 +311,12 @@ class App(Base):
# TODO: add support for customizing this in project.conf # TODO: add support for customizing this in project.conf
def htdocs_dir(self, project: str) -> str: def htdocs_dir(self, project: str) -> str:
return self.find_dir(project, ["/src/html/htdocs", "/tools/html/htdocs", "/htdocs"], return self.find_dir(project, ['/src/html/htdocs', '/tools/html/htdocs', '/htdocs'],
["/srv/www/proj/" + project]) ['/srv/www/proj/' + project])
# TODO: add support for customizing this in project.conf # TODO: add support for customizing this in project.conf
def tmpl_dir(self, name: str) -> str: def tmpl_dir(self, name: str) -> str:
return self.find_dir(name, ["/tmpl"], ["/opt/" + name + "/share/tmpl"]) return self.find_dir(name, ['/tmpl'], ['/opt/' + name + '/share/tmpl'])
def strip_module_from_spec(self, mod): def strip_module_from_spec(self, mod):
return re.sub(r'-dev$|-devel$|-run$', '', re.split('([=><]+)', mod)[0].strip()) return re.sub(r'-dev$|-devel$|-run$', '', re.split('([=><]+)', mod)[0].strip())
@ -362,7 +362,7 @@ class App(Base):
cont_line = '' cont_line = ''
rx = re.compile(r'^\s*' + key + r'\s*=\s*(.*)\s*$') rx = re.compile(r'^\s*' + key + r'\s*=\s*(.*)\s*$')
for line in lines: for line in lines:
#log(DEBUG, " looking for >%s< in line=>%s<" % (key, line)) #log(DEBUG, ' looking for "%s" in line="%s"' % (key, line))
m = re.search(rx, line) m = re.search(rx, line)
if m is not None: if m is not None:
return m.group(1) return m.group(1)
@ -370,11 +370,11 @@ class App(Base):
def scan_section_debug(f, key: str) -> str|None: def scan_section_debug(f, key: str) -> str|None:
ret = scan_section(f, key) ret = scan_section(f, key)
#log(DEBUG, " returning", rr) #log(DEBUG, ' returning', rr)
return ret return ret
try: try:
#log(DEBUG, "looking for {}::[{}].{}".format(path, section, key)) #log(DEBUG, 'looking for {}::[{}].{}'.format(path, section, key))
with open(path, 'r') as f: with open(path, 'r') as f:
if not len(section): if not len(section):
rr = scan_section(f, key) rr = scan_section(f, key)
@ -384,7 +384,7 @@ class App(Base):
return scan_section(f, key) return scan_section(f, key)
return None return None
except: except:
log(DEBUG, path, "not found") log(DEBUG, path, 'not found')
# TODO: handle this special case cleaner somewhere up the stack # TODO: handle this special case cleaner somewhere up the stack
if section == 'build' and key == 'libname': if section == 'build' and key == 'libname':
return 'none' return 'none'
@ -408,12 +408,12 @@ class App(Base):
fd.close() fd.close()
return ret return ret
except EnvironmentError: except EnvironmentError:
log(DEBUG, f'"Ignoring unreadable file "{version_path}"') log(DEBUG, f'Ignoring unreadable file "{version_path}"')
continue continue
raise Exception(f'No version file found for project "{project}"') raise Exception(f'No version file found for project "{project}"')
path = proj_root + '/make/project.conf' path = proj_root + '/make/project.conf'
ret = self.read_value(path, section, key) ret = self.read_value(path, section, key)
log(DEBUG, "Lookup %s -> %s / [%s%s] -> \"%s\"" % log(DEBUG, 'Lookup %s -> %s / [%s%s] -> "%s"' %
(self.__top_name, project, section, '.' + key if key else '', ret)) (self.__top_name, project, section, '.' + key if key else '', ret))
return ret return ret
@ -428,7 +428,7 @@ class App(Base):
for key in keys: for key in keys:
vals = self.get_value(p, section, key) vals = self.get_value(p, section, key)
if vals: if vals:
ret += [val.strip() for val in vals.split(",")] ret += [val.strip() for val in vals.split(',')]
return list(dict.fromkeys(ret)) # Remove duplicates, keep ordering return list(dict.fromkeys(ret)) # Remove duplicates, keep ordering
def get_project_refs(self, projects: list[str], sections: list[str], def get_project_refs(self, projects: list[str], sections: list[str],
@ -458,7 +458,7 @@ class App(Base):
return ' '.join(reversed(vals)) return ' '.join(reversed(vals))
def is_excluded_from_build(self, project: str) -> str|None: def is_excluded_from_build(self, project: str) -> str|None:
log(DEBUG, "checking if project " + project + " is excluded from build") log(DEBUG, 'checking if project ' + project + ' is excluded from build')
exclude = self.get_project_refs([ project ], ['build'], 'exclude', exclude = self.get_project_refs([ project ], ['build'], 'exclude',
scope = Scope.One, add_self=False, names_only=True) scope = Scope.One, add_self=False, names_only=True)
cascade = self.distro.os_cascade + [ 'all' ] cascade = self.distro.os_cascade + [ 'all' ]