Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the ability to pass arguments to as a string #726

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
38 changes: 37 additions & 1 deletion kivy_ios/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1335,6 +1335,8 @@ def build(self):
help="do not use pbzip2 for bzip2 decompression")
parser.add_argument("--add-custom-recipe", action="append", default=[],
help="Path to custom recipe")
parser.add_argument("--r", type=str, default='', help="Requirements from file")

args = parser.parse_args(sys.argv[2:])

if args.arch:
Expand Down Expand Up @@ -1365,7 +1367,41 @@ def build(self):
if ctx.use_pbzip2:
logger.info("Using pbzip2 to decompress bzip2 data")

build_recipes(args.recipe, ctx)
if args.r:
recipe = self.parse_requirements(args.r)
else:
recipe = args.recipe

build_recipes(recipe, ctx)

def parse_requirements(self, filename: str) -> list:
"""
Parse a requirements file into a list
:param filename: path to requirements file
:returns: list
"""

if not exists(filename):
logger.error(f"{filename} isn't a valid path")
raise FileNotFoundError

req_file = open(filename)

requirements = []

for line in req_file:
if line == '' or line == '\n' or line.startswith('-'):
continue

elif not line or line.startswith('#'):
# comments are lines that start with # only
continue

else:
line = line.replace('\n', '').strip()
requirements.append(line)

return requirements

def recipes(self):
parser = argparse.ArgumentParser(
Expand Down