move the setup file to the correct location
This commit is contained in:
@@ -11,7 +11,7 @@ from distutils.command.build_py import build_py_2to3 as _build_py
|
|||||||
# @brief Creates Protobuf python files to encode and decode messages
|
# @brief Creates Protobuf python files to encode and decode messages
|
||||||
# @param[in] source The protobuf source file
|
# @param[in] source The protobuf source file
|
||||||
def generateProtobuf(source):
|
def generateProtobuf(source):
|
||||||
output = source.replace('.proto', '_pb2.py').replace('../src/protobuf/', '')
|
output = source.replace('.proto', '_pb2.py').replace('src/protobuf/', '')
|
||||||
|
|
||||||
if (not os.path.exists(output) or (os.path.exists(source) and os.path.getmtime(source) > os.path.getmtime(output))):
|
if (not os.path.exists(output) or (os.path.exists(source) and os.path.getmtime(source) > os.path.getmtime(output))):
|
||||||
print('Generating %s...' % output)
|
print('Generating %s...' % output)
|
||||||
@@ -20,11 +20,11 @@ def generateProtobuf(source):
|
|||||||
sys.stderr.write('Cannot find %s' % source)
|
sys.stderr.write('Cannot find %s' % source)
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
if not os.path.exists('../external/bin/protoc.exe'):
|
if not os.path.exists('external/bin/protoc.exe'):
|
||||||
sys.stderr.write('Cannot find proto-compiler')
|
sys.stderr.write('Cannot find proto-compiler')
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
command = [ '../external/bin/protoc.exe', '-I../src/protobuf/', '-I.', '--python_out=.', source]
|
command = [ 'external/bin/protoc.exe', '-Isrc/protobuf/', '-I.', '--python_out=.', source]
|
||||||
if 0 != subprocess.call(command):
|
if 0 != subprocess.call(command):
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ class clean(_clean):
|
|||||||
if filepath.endswith('_pb2.py') or filepath.endswith('.pyc'):
|
if filepath.endswith('_pb2.py') or filepath.endswith('.pyc'):
|
||||||
os.remove(filepath)
|
os.remove(filepath)
|
||||||
for dirname in dirnames:
|
for dirname in dirnames:
|
||||||
if 'Arrival_MANager.egg-info' == dirname:
|
if 'Arrival_MANager.egg-info' == dirname or 'build' == dirname:
|
||||||
shutil.rmtree(os.path.join(dirpath, dirname))
|
shutil.rmtree(os.path.join(dirpath, dirname))
|
||||||
_clean.run(self)
|
_clean.run(self)
|
||||||
|
|
||||||
@@ -46,10 +46,10 @@ class clean(_clean):
|
|||||||
# @param[in] _build_py Instance of setuptools to build the system
|
# @param[in] _build_py Instance of setuptools to build the system
|
||||||
class build_py(_build_py):
|
class build_py(_build_py):
|
||||||
def run(self):
|
def run(self):
|
||||||
generateProtobuf('../src/protobuf/Aircraft.proto')
|
generateProtobuf('src/protobuf/Aircraft.proto')
|
||||||
generateProtobuf('../src/protobuf/AircraftReport.proto')
|
generateProtobuf('src/protobuf/AircraftReport.proto')
|
||||||
generateProtobuf('../src/protobuf/AircraftSchedule.proto')
|
generateProtobuf('src/protobuf/AircraftSchedule.proto')
|
||||||
generateProtobuf('../src/protobuf/BaseTypes.proto')
|
generateProtobuf('src/protobuf/BaseTypes.proto')
|
||||||
_build_py.run(self)
|
_build_py.run(self)
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
Reference in New Issue
Block a user