Skip to content

Commit

Permalink
Fixed command line crash #41
Browse files Browse the repository at this point in the history
  • Loading branch information
AryazE committed Oct 26, 2023
1 parent 28ff7d5 commit a4c25d2
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 41 deletions.
2 changes: 1 addition & 1 deletion src/dynapyt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""DynaPyt"""
__version__ = "1.2.0"
__version__ = "1.2.1"
23 changes: 13 additions & 10 deletions src/dynapyt/instrument/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@
from shutil import copyfile
from dynapyt.utils.hooks import get_hooks_from_analysis

parser = argparse.ArgumentParser()
parser.add_argument(
"--files",
help="Python files to instrument or .txt file with all file paths",
nargs="+",
)
parser.add_argument(
"--analysis", help="Analysis class(es) (full dotted path)", nargs="+"
)


def gather_files(files_arg):
if len(files_arg) == 1 and files_arg[0].endswith(".txt"):
Expand Down Expand Up @@ -70,6 +60,19 @@ def instrument_file(file_path, selected_hooks):


if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"--files",
help="Python files to instrument or .txt file with all file paths",
nargs="+",
required=True,
)
parser.add_argument(
"--analysis",
help="Analysis class(es) (full dotted path)",
nargs="+",
required=True,
)
args = parser.parse_args()
files = gather_files(args.files)
analysis = args.analysis
Expand Down
28 changes: 17 additions & 11 deletions src/dynapyt/run_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,6 @@
import time
from multiprocessing import Pool

parser = argparse.ArgumentParser()
parser.add_argument("--directory", help="Directory of the project to analyze")
parser.add_argument("--entry", help="Entry module of the execution")
parser.add_argument(
"--analysis", help="Analysis class(es) (full dotted path)", nargs="+"
)
parser.add_argument(
"--skip-instrumentation", help="Skip instrumentation", action="store_true"
)
parser.add_argument("--time-limit", help="Time limit for instrumentation in minutes")


def process_files(cmd_list, file_path):
comp_proc = run(cmd_list)
Expand All @@ -25,6 +14,23 @@ def process_files(cmd_list, file_path):


if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"--directory", help="Directory of the project to analyze", required=True
)
parser.add_argument("--entry", help="Entry module of the execution", required=True)
parser.add_argument(
"--analysis",
help="Analysis class(es) (full dotted path)",
nargs="+",
required=True,
)
parser.add_argument(
"--skip-instrumentation", help="Skip instrumentation", action="store_true"
)
parser.add_argument(
"--time-limit", help="Time limit for instrumentation in minutes"
)
args = parser.parse_args()
start = args.directory
analysis = args.analysis
Expand Down
13 changes: 7 additions & 6 deletions src/dynapyt/run_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ def run_analysis(
_rt.end_execution()


parser = argparse.ArgumentParser()
parser.add_argument("--entry", help="Entry file for execution")
parser.add_argument("--analysis", help="Analysis class name(s)", nargs="+")
parser.add_argument("--name", help="Associates a given name with current run")
parser.add_argument("--coverage", help="Enables coverage", action="store_true")

if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--entry", help="Entry file for execution", required=True)
parser.add_argument(
"--analysis", help="Analysis class name(s)", nargs="+", required=True
)
parser.add_argument("--name", help="Associates a given name with current run")
parser.add_argument("--coverage", help="Enables coverage", action="store_true")
args = parser.parse_args()
name = args.name
analyses = args.analysis
Expand Down
29 changes: 16 additions & 13 deletions src/dynapyt/run_instrumentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,29 @@ def instrument_dir(
print("#################### Instrumentation took " + str(time.time() - start_time))


parser = argparse.ArgumentParser()
parser.add_argument("--directory", help="Directory of the project to analyze")
parser.add_argument(
"--analysis", help="Analysis class(es) (full dotted path)", nargs="+"
)
parser.add_argument(
"--external_dir",
help="Place instrumented files in another directory",
dest="external_dir",
action="store_true",
)


def process_files(cmd_list, file_path):
comp_proc = run(cmd_list)
if comp_proc.returncode != 0:
print("Error at", file_path)


if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"--directory", help="Directory of the project to analyze", required=True
)
parser.add_argument(
"--analysis",
help="Analysis class(es) (full dotted path)",
nargs="+",
required=True,
)
parser.add_argument(
"--external_dir",
help="Place instrumented files in another directory",
dest="external_dir",
action="store_true",
)
args = parser.parse_args()
start = args.directory
analysis = args.analysis
Expand Down

0 comments on commit a4c25d2

Please sign in to comment.