From 81b4dc41ab7651ccab5bea489812203ef8beab92 Mon Sep 17 00:00:00 2001 From: Max Kaye Date: Wed, 11 Apr 2018 11:34:17 +1000 Subject: [PATCH 1/2] add support for --allow-paths --- flattener/core.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/flattener/core.py b/flattener/core.py index 855c4a7..c30d0e6 100755 --- a/flattener/core.py +++ b/flattener/core.py @@ -87,15 +87,19 @@ def main(): help="Specifies the output destination filename. Outputs to stdout by default.") parser.add_argument("--solc-paths", default="", help="Specifies the path replacements to pass onto solidity. See solc --help for more information.") + parser.add_argument("--allow-paths", default="", + help="Specify list of paths (comma separated) to allow solc to import files from. See solc --help for more information.") args = parser.parse_args() - if args.solc_paths: - solc_args = ["solc", args.solc_paths, "--ast", args.target_solidity_file] - else: - solc_args = ["solc", "--ast", args.target_solidity_file] + solc_command = ["solc"] + solc_command += [args.solc_paths] if args.solc_paths else [] + solc_command += ["--ast"] + solc_command += ["--allow-paths", args.allow_paths] if args.allow_paths else [] + solc_command += [args.target_solidity_file] + solc_proc = subprocess.run(solc_args, stdout=subprocess.PIPE, universal_newlines=True) solc_proc.check_returncode() flatten_contract(solc_proc.stdout, args.output) if __name__ == '__main__': - main() \ No newline at end of file + main() From e1ec864612f027a6d699d6f12a0d1b4f9817d21e Mon Sep 17 00:00:00 2001 From: Max Kaye Date: Wed, 11 Apr 2018 11:46:21 +1000 Subject: [PATCH 2/2] Fix bad variable name --- flattener/core.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/flattener/core.py b/flattener/core.py index c30d0e6..2552619 100755 --- a/flattener/core.py +++ b/flattener/core.py @@ -91,11 +91,11 @@ def main(): help="Specify list of paths (comma separated) to allow solc to import files from. See solc --help for more information.") args = parser.parse_args() - solc_command = ["solc"] - solc_command += [args.solc_paths] if args.solc_paths else [] - solc_command += ["--ast"] - solc_command += ["--allow-paths", args.allow_paths] if args.allow_paths else [] - solc_command += [args.target_solidity_file] + solc_args = ["solc"] + solc_args += [args.solc_paths] if args.solc_paths else [] + solc_args += ["--ast"] + solc_args += ["--allow-paths", args.allow_paths] if args.allow_paths else [] + solc_args += [args.target_solidity_file] solc_proc = subprocess.run(solc_args, stdout=subprocess.PIPE, universal_newlines=True) solc_proc.check_returncode()