Browse Source

buildorder.py: shorten code a bit

android-5
Henrik Grimler 6 years ago
committed by Fredrik Fornwall
parent
commit
4343677bcc
  1. 16
      scripts/buildorder.py

16
scripts/buildorder.py

@ -32,24 +32,12 @@ def die(msg):
def parse_build_file_dependencies(path):
"Extract the dependencies of a build.sh or *.subpackage.sh file."
pkg_dep_prefix = 'TERMUX_PKG_DEPENDS='
pkg_build_dep_prefix = 'TERMUX_PKG_BUILD_DEPENDS='
subpkg_dep_prefix = 'TERMUX_SUBPKG_DEPENDS='
dependencies = []
with open(path, encoding="utf-8") as build_script:
prefix = None
for line in build_script:
if line.startswith(pkg_dep_prefix):
prefix = pkg_dep_prefix
elif line.startswith(pkg_build_dep_prefix):
prefix = pkg_build_dep_prefix
elif line.startswith(subpkg_dep_prefix):
prefix = subpkg_dep_prefix
else:
continue
dependencies_string = line[len(prefix):]
if line.startswith( ('TERMUX_PKG_DEPENDS', 'TERMUX_PKG_BUILD_DEPENDS', 'TERMUX_SUBPKG_DEPENDS') ):
dependencies_string = line.split('DEPENDS=')[1]
for char in "\"'\n":
dependencies_string = dependencies_string.replace(char, '')

Loading…
Cancel
Save