Skip to content

Commit

Permalink
Experimental platform-dependent build status file
Browse files Browse the repository at this point in the history
  • Loading branch information
pagmatt committed Jan 27, 2023
1 parent f7343c6 commit 9393e06
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions sem/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import time
import uuid
import sem.utils
import sys

from tqdm import tqdm

Expand Down Expand Up @@ -64,7 +65,10 @@ def __init__(self, path, script, optimized=True, skip_configuration=False,
# ns-3's build status output is used to get the executable path for the
# specified script.
if os.path.exists(os.path.join(self.path, "ns3")):
build_status_path = os.path.join(path, '.lock-ns3_linux_build')
# In newer versions of ns-3 (3.36+), the name of the build status file is
# platform-dependent
build_status_fname = ".lock-ns3_%s_build" % sys.platform
build_status_path = os.path.join(path, build_status_fname)
else:
if optimized:
build_status_path = os.path.join(path,
Expand All @@ -76,11 +80,11 @@ def __init__(self, path, script, optimized=True, skip_configuration=False,
# By importing the file, we can naturally get the dictionary
try: # This only works on Python >= 3.5
if os.path.exists(os.path.join(self.path, "ns3")):
spec = importlib.util.spec_from_file_location('.lock-ns3_linux_build',
build_status_path)
spec = importlib.util.spec_from_file_location(build_status_fname,
build_status_path)
else:
spec = importlib.util.spec_from_file_location('build_status',
build_status_path)
build_status_path)
build_status = importlib.util.module_from_spec(spec)
spec.loader.exec_module(build_status)
except (AttributeError): # This happens in Python <= 3.4
Expand Down

0 comments on commit 9393e06

Please sign in to comment.