|
@@ -1,6 +1,7 @@
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
import os
|
|
|
+import re
|
|
|
import shutil
|
|
|
import subprocess
|
|
|
import sys
|
|
@@ -28,6 +29,18 @@ def generateProtobuf(source):
|
|
|
if 0 != subprocess.call(command):
|
|
|
sys.exit(-1)
|
|
|
|
|
|
+ # check if we need to replace some import commands
|
|
|
+ replaced = False
|
|
|
+ content = open(output, 'r').read()
|
|
|
+ for entry in re.findall('import.[A-Z].*.as.*', content):
|
|
|
+ content = content.replace(entry, 'from . ' + entry)
|
|
|
+ replaced = True
|
|
|
+
|
|
|
+ # update the content
|
|
|
+ if replaced:
|
|
|
+ with open(output, 'w') as file:
|
|
|
+ file.write(content)
|
|
|
+
|
|
|
# @brief Cleans up all auto-generated files and folders
|
|
|
# @param[in] _clean Instance of setuptools to clean up the system
|
|
|
class clean(_clean):
|
|
@@ -76,6 +89,7 @@ setup(
|
|
|
'configparser',
|
|
|
'protobuf',
|
|
|
'pyzmq',
|
|
|
+ 're',
|
|
|
'setuptools'
|
|
|
]
|
|
|
)
|