-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for copying executable files when precomputing data
- Loading branch information
Showing
3 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from os.path import exists, join | ||
|
||
class ExecutableResolver(object): | ||
''' | ||
Provides functionality for resolving executable files given search paths and library names | ||
''' | ||
|
||
def __init__(self, platform, searchPaths): | ||
''' | ||
Creates a new executable resolver for the specified platform and executable search paths | ||
''' | ||
self.platform = platform | ||
self.searchPaths = searchPaths | ||
|
||
def resolve(self, executableName): | ||
''' | ||
Attempts to resolve the path to the executable file for the specified name | ||
''' | ||
|
||
# Determine the appropriate filename suffix for the target platform | ||
suffix = '.exe' if self.platform == 'Windows' else '' | ||
|
||
# Iterate through each of our search paths and attempt to find the executable file | ||
for searchDir in self.searchPaths: | ||
resolved = join(searchDir, executableName + suffix) | ||
if exists(resolved): | ||
return resolved | ||
|
||
# Failed to resolve the executable file | ||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters