Skip to content

Commit ac404b3

Browse files
committed
setup.py: fix for issue #96
1 parent a686f55 commit ac404b3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

setup.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@
44

55
import os.path
66
import subprocess
7+
import shutil
78

8-
PROTOC_BIN = "/usr/bin/protoc"
9+
PROTOC_EXEC = "protoc"
910

1011
CURRENT_DIR = os.path.abspath( os.path.dirname( __file__ ) )
1112

1213
class ProtobufBuilder(_build):
1314

1415
def run(self):
1516
# check if protobuf is installed
16-
if not os.path.isfile(PROTOC_BIN):
17+
exec_path = shutil.which(PROTOC_EXEC)
18+
if exec_path is None:
1719
raise Exception("You should install protobuf compiler")
1820

1921
print("Building protobuf file")
20-
subprocess.run([PROTOC_BIN,
22+
subprocess.run([exec_path,
2123
"--proto_path=" + CURRENT_DIR,
2224
"--python_out=" + CURRENT_DIR + "/gpapi/",
2325
CURRENT_DIR + "/googleplay.proto"])

0 commit comments

Comments
 (0)