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

Add --allow-paths argument #24

Open
wants to merge 2 commits into
base: development
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions flattener/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_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()
flatten_contract(solc_proc.stdout, args.output)

if __name__ == '__main__':
main()
main()