23
23
from distutils .command .build import build
24
24
from distutils .command .clean import clean
25
25
from distutils .cmd import Command
26
+ from distutils .spawn import find_executable
26
27
from setuptools import find_packages
27
28
from setuptools import setup
28
29
from setuptools .command .test import test
@@ -63,19 +64,23 @@ def initialize_options(self):
63
64
# Default to /usr/local for Homebrew
64
65
prefix = '/usr/local'
65
66
else :
66
- print ('Warning: mfg-inspector output is not fully implemented for '
67
- 'Windows. OpenHTF will be installed without it.' )
68
- self .skip_proto = True
67
+ prefix = None
69
68
70
- maybe_protoc = os .path .join (prefix , 'bin' , 'protoc' )
71
- if os .path .isfile (maybe_protoc ) and os .access (maybe_protoc , os .X_OK ):
69
+ self .protoc = None
70
+ if prefix :
71
+ maybe_protoc = os .path .join (prefix , 'bin' , 'protoc' )
72
+ if os .path .isfile (maybe_protoc ) and os .access (maybe_protoc , os .X_OK ):
72
73
self .protoc = maybe_protoc
73
- else :
74
+ else :
74
75
print ('Warning: protoc not found at %s' % maybe_protoc )
75
76
print ('setup will attempt to run protoc with no prefix.' )
76
- self .protoc = 'protoc'
77
+ if not self .protoc :
78
+ self .protoc = find_executable ('protoc' )
79
+ pc_path = os .path .dirname (find_executable ('protoc' ))
80
+ self .protodir = os .path .abspath (os .path .dirname (pc_path ) + '/../lib' )
77
81
78
- self .protodir = os .path .join (prefix , 'include' )
82
+ else :
83
+ self .protodir = os .path .join (prefix , 'include' )
79
84
self .indir = os .getcwd ()
80
85
self .outdir = os .getcwd ()
81
86
@@ -109,6 +114,9 @@ def run(self):
109
114
'"protobuf-compiler" and "libprotobuf-dev" packages.' )
110
115
elif sys .platform == 'darwin' :
111
116
print ('On Mac, protobuf is often installed via homebrew.' )
117
+ else :
118
+ print ('On Windows, protoc should be installed and added '
119
+ 'to the path.' )
112
120
raise
113
121
except subprocess .CalledProcessError :
114
122
print ('Could not build proto files.' )
@@ -130,7 +138,7 @@ def run(self):
130
138
'mutablerecords>=0.4.1,<2.0' ,
131
139
'oauth2client>=1.5.2,<2.0' ,
132
140
'protobuf>=3.0.0,<4.0' ,
133
- 'pyaml>=15.3.1,<16 .0' ,
141
+ 'PyYAML>=3.10,<4 .0' ,
134
142
'pyOpenSSL>=17.1.0,<18.0' ,
135
143
'sockjs-tornado>=1.0.3,<2.0' ,
136
144
'tornado>=4.3,<5.0' ,
0 commit comments