-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #287 from lasp/feature/allow-build-module-symlink-…
…overwrite Fix message package __init__.py symlink overwrite
- Loading branch information
Showing
3 changed files
with
44 additions
and
38 deletions.
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
27 changes: 27 additions & 0 deletions
27
src/architecture/messaging/msgAutoSource/generateMessagePackageInit.py
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,27 @@ | ||
import os | ||
import pathlib | ||
import sys | ||
|
||
path = os.path.dirname(os.path.abspath(__file__)) | ||
sys.path.append(path + '/../../../../../Basilisk/src/architecture/messaging/msgAutoSource') | ||
|
||
if __name__ == "__main__": | ||
""" | ||
In the message package directory create an __init__.py file | ||
containing all the message packages. If the file exists, overwrite it. | ||
""" | ||
modulePath = sys.argv[1] | ||
isExist = os.path.exists(modulePath) | ||
os.makedirs(modulePath, exist_ok=True) | ||
mainImportFid = open(modulePath + '/__init__.py', 'w') | ||
for i in range(2, len(sys.argv)): | ||
headerInputPath = sys.argv[i] | ||
for fileName in os.listdir(headerInputPath): | ||
if fileName.endswith(".h") or fileName.endswith(".hpp"): | ||
className = os.path.splitext(fileName)[0] | ||
msgName = className.split('Payload')[0] | ||
mainImportFid.write('from Basilisk.architecture.messaging.' + className + ' import *\n') | ||
mainImportFid.close() | ||
oldModulePath = modulePath.split('messaging')[0] + 'cMsgCInterfacePy' | ||
pathlib.Path(oldModulePath).unlink(missing_ok=True) | ||
os.symlink(modulePath, oldModulePath) |
22 changes: 0 additions & 22 deletions
22
src/architecture/messaging/msgAutoSource/generatePackageInit.py
This file was deleted.
Oops, something went wrong.