Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit d3fca9e

Browse files
authored
Merge pull request #117 from vmarkovtsev/master
Fix import failure on Python 3.7
2 parents c258a3d + 0b95794 commit d3fca9e

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
language: python
22
sudo: true
3+
dist: xenial
34
services:
45
- docker
56
cache:
@@ -8,6 +9,7 @@ cache:
89
python:
910
- "3.5"
1011
- "3.6"
12+
- "3.7"
1113
install:
1214
- wget https://github.com/bblfsh/client-python/releases/download/v2.2.1/protobuf-python_3.4.1-1_amd64.deb
1315
- sudo dpkg -i protobuf-python_3.4.1-1_amd64.deb

setup.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import fileinput
12
import logging
23
import os
34
import pkg_resources
@@ -81,7 +82,8 @@ def cpr(src, dst):
8182
src = src.format(**FORMAT_ARGS)
8283
dst = dst.format(**FORMAT_ARGS)
8384
log.info("cp -pr %s %s", src, dst)
84-
shutil.rmtree(dst, ignore_errors=True)
85+
if os.path.isdir(dst):
86+
shutil.rmtree(dst)
8587
shutil.copytree(src, dst, symlinks=True)
8688

8789

@@ -161,15 +163,22 @@ def protoc(python_out, proto_file, *extra, grpc=True):
161163
log.info("%s -m grpc.tools.protoc " + " ".join(main_args), sys.executable)
162164
protoc_module.main(main_args)
163165

166+
sdk_root = j("bblfsh", "gopkg", "in", "bblfsh", "sdk", SDK_MAJOR)
164167
# SDK
165-
protoc(j("bblfsh", "gopkg", "in", "bblfsh", "sdk", SDK_MAJOR, "protocol"),
168+
protoc(j(sdk_root, "protocol"),
166169
j("gopkg.in", "bblfsh", "sdk." + SDK_MAJOR, "protocol", "generated.proto"),
167170
"-I" + j("gopkg.in", "bblfsh", "sdk." + SDK_MAJOR, "protocol"))
168171
# UAST
169172
protoc("bblfsh", j("github.com", "gogo", "protobuf", "gogoproto", "gogo.proto"),
170173
grpc=False)
171174
protoc("bblfsh", j("gopkg.in", "bblfsh", "sdk." + SDK_MAJOR, "uast", "generated.proto"),
172175
grpc=False)
176+
for line in fileinput.input([j(sdk_root, "protocol", "generated_pb2.py"),
177+
j(sdk_root, "uast", "generated_pb2.py")],
178+
inplace=True):
179+
print(line.replace("from github.com.gogo.protobuf.gogoproto import",
180+
"from bblfsh.github.com.gogo.protobuf.gogoproto import"),
181+
end="")
173182

174183

175184
def do_get_deps():

0 commit comments

Comments
 (0)