diff options
author | ng0 <ng0@n0.is> | 2019-10-04 14:02:27 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2019-10-04 14:02:27 +0000 |
commit | b2ad1a45ece15be2be0c2882f095d43b50ce7a88 (patch) | |
tree | 639b000cb8c5525707802306ff5fdfcc482618a0 | |
parent | cadf5c69fbe8ff4b3aaafd0a9318c6237e250d49 (diff) | |
download | build-common-b2ad1a45ece15be2be0c2882f095d43b50ce7a88.tar.gz build-common-b2ad1a45ece15be2be0c2882f095d43b50ce7a88.tar.bz2 build-common-b2ad1a45ece15be2be0c2882f095d43b50ce7a88.zip |
remove ifelse branches
-rw-r--r-- | configure.py | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/configure.py b/configure.py index 35edac0..68b9176 100644 --- a/configure.py +++ b/configure.py @@ -36,42 +36,41 @@ def _read_prefix(): logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger(__name__) + + if 'DEBUG' in os.environ: + logger.debug('PREFIX from argv') + parser = argparse.ArgumentParser() + parser.add_argument("-p", + "--prefix", + type=str, + default="/usr/local", + # required=True, + help='Directory prefix for installation') + parser.add_argument("-y", + "--yarn", + type=str, + required=True, + help='name of yarn executable') + if 'DEBUG' in os.environ: + logger.debug('parser.parse_args step') + args = parser.parse_args() + if 'DEBUG' in os.environ: + logger.debug('%s', args) if 'PREFIX' in os.environ: if 'DEBUG' in os.environ: logger.debug('PREFIX from environment') - myprefix = os.environ.get('PREFIX') - if myprefix is not None and os.path.isdir(myprefix) is True: + p_myprefix = os.environ.get('PREFIX') + if p_myprefix is not None and os.path.isdir(p_myprefix) is True: if 'DEBUG' in os.environ: - logger.debug('PREFIX from environment: %s', myprefix) - return myprefix - + logger.debug('PREFIX from environment: %s', p_myprefix) + myprefix = p_myprefix else: - if 'DEBUG' in os.environ: - logger.debug('PREFIX from argv') - parser = argparse.ArgumentParser() - parser.add_argument("-p", - "--prefix", - type=str, - default="/usr/local", - # required=True, - help='Directory prefix for installation') - parser.add_argument("-y", - "--yarn", - type=str, - required=True, - help='name of yarn executable') - if 'DEBUG' in os.environ: - logger.debug('parser.parse_args step') - args = parser.parse_args() - if 'DEBUG' in os.environ: - logger.debug('%s', args) myprefix = args.prefix - yarnexe = args.yarn - if 'DEBUG' in os.environ: - logger.debug('%s', repr(myprefix)) - # if args.prefix is not None and os.path.isdir(myprefix) is True: - if args.prefix and os.path.isdir(myprefix) is True: - return [myprefix, yarnexe]; + yarnexe = args.yarn + if 'DEBUG' in os.environ: + logger.debug('%s', repr(myprefix)) + if args.prefix and os.path.isdir(myprefix) is True: + return [myprefix, yarnexe]; def main(): # mylist = str(_read_prefix()) |