#!/usr/bin/env python3 | |
import sys | |
import os | |
import os.path | |
from nanopb_generator import invoke_protoc | |
if __name__ == '__main__': | |
# Add script directory to path so that protoc-gen-nanopb gets found | |
if getattr(sys, 'frozen', False): | |
mypath = os.path.dirname(sys.executable) # For pyInstaller | |
else: | |
mypath = os.path.dirname(__file__) | |
os.environ["PATH"] = mypath + os.pathsep + os.environ["PATH"] | |
status = invoke_protoc(['protoc'] + sys.argv[1:]) | |
sys.exit(status) |