Skip to content

Commit 871e636

Browse files
authored
Merge pull request #671 from TeamCOMPAS/issue-664-pythonSubmit
Updated pythonSubmit.py per issue #664
2 parents 8b0457f + e06728a commit 871e636

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

preProcessing/pythonSubmit.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,34 @@ class pythonProgramOptions:
2828
compas_executable_override = os.environ.get('COMPAS_EXECUTABLE_PATH')
2929

3030
if (compas_executable_override is None):
31-
git_directory = os.environ.get('COMPAS_ROOT_DIR')
32-
compas_executable = os.path.join(git_directory, 'src/COMPAS')
31+
32+
# we should fix this one day - we should not assume that the COMPAS executable
33+
# is in the 'src' directory. The standard is to put the object files created
34+
# by the compile into the 'obj' directory, and the executable files created by
35+
# the link in the 'bin' directory.
36+
#
37+
# for now though, because this is how everybody expects it to be, we'll just check
38+
# that the path to the root directory (the parent directory of the directory in
39+
# which we expect the executable to reside - for now, 'src') is set to something.
40+
41+
compas_root_dir = os.environ.get('COMPAS_ROOT_DIR')
42+
assert compas_root_dir is not None, "Unable to locate the COMPAS executable: check that the environment variable COMPAS_ROOT_DIR is set correctly, and the COMPAS executable exists."
43+
44+
# construct path to executable
45+
#
46+
# ideally we wouldn't have the 'src' directory name (or any other directory name)
47+
# prepended to the executable name - if we just execute the executable name on its
48+
# own, as long as the user navigates to the directory in which the executable resides
49+
# they don't need to set the COMPAS_ROOT_DIR environment variable
50+
51+
compas_executable = os.path.join(compas_root_dir, 'src/COMPAS')
3352
else:
3453
compas_executable = compas_executable_override
3554

55+
# check that a file with the correct name exists where we expect it to
56+
assert os.path.isfile(compas_executable), "Unable to locate the COMPAS executable: check that the environment variable COMPAS_ROOT_DIR is set correctly, and the COMPAS executable exists."
57+
58+
3659
enable_warnings = False # option to enable/disable warning messages
3760

3861
number_of_systems = 10 #number of systems per batch

0 commit comments

Comments
 (0)