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

Commit b64ff3a

Browse files
authored
Merge pull request #53 from juanjux/fix/manifest_gogoproto
Bugfixes
2 parents 998b5ee + af7e0ba commit b64ff3a

File tree

3 files changed

+29
-11
lines changed

3 files changed

+29
-11
lines changed

MANIFEST.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ include DCO
44
include LICENSE
55
include MAINTAINERS
66
include Makefile
7+
include github.com/gogo/protobuf/gogoproto/gogo.proto
8+
include gopkg.in/bblfsh/sdk.v1/protocol/generated.proto
9+
include gopkg.in/bblfsh/sdk.v1/uast/generated.proto
10+
prune bblfsh/libuast

bblfsh/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def setup():
2929
return args
3030

3131
def run_query(root, query, mapn, as_array):
32-
result = filter(root, query)
32+
result = list(filter(root, query))
3333

3434
if not result:
3535
print("Nothing found")

setup.py

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,33 @@
33
import sys
44

55
from setuptools import setup, find_packages, Extension
6+
from setuptools.command.build_ext import build_ext
67

78
LIBUAST_VERSION = "v1.3.0"
89
SDK_VERSION = "v1.4.2"
910
SDK_MAJOR = SDK_VERSION.split('.')[0]
1011
PYTHON = "python3"
1112

1213

14+
libraries = ['xml2']
15+
sources = ['bblfsh/pyuast.c']
16+
17+
18+
class CustomBuildExt(build_ext):
19+
def run(self):
20+
global libraries
21+
global sources
22+
23+
if "--global-uast" in sys.argv:
24+
libraries.append('uast')
25+
else:
26+
sources.append('bblfsh/libuast/uast.c')
27+
sources.append('bblfsh/libuast/roles.c')
28+
29+
getLibuast()
30+
build_ext.run(self)
31+
32+
1333
def runc(cmd):
1434
cmd = cmd.format(**globals())
1535
print(cmd)
@@ -90,9 +110,6 @@ def clean():
90110

91111

92112
def main():
93-
libraries = ['xml2']
94-
sources = ['bblfsh/pyuast.c']
95-
96113
# The --global-uast flag allows to install the python driver using the installed uast library
97114
if "--getdeps" in sys.argv:
98115
doGetDeps()
@@ -102,12 +119,6 @@ def main():
102119
clean()
103120
sys.exit(0)
104121

105-
if "--global-uast" in sys.argv:
106-
libraries.append('uast')
107-
else:
108-
sources.append('bblfsh/libuast/uast.c')
109-
sources.append('bblfsh/libuast/roles.c')
110-
111122
# download c dependencies
112123
if not os.path.exists("bblfsh/libuast"):
113124
doGetDeps()
@@ -121,9 +132,12 @@ def main():
121132
'/usr/include', '/usr/include/libxml2'], sources=sources)
122133

123134
setup(
135+
cmdclass = {
136+
"build_ext": CustomBuildExt,
137+
},
124138
name="bblfsh",
125139
description="Fetches Universal Abstract Syntax Trees from Babelfish.",
126-
version="2.3.0",
140+
version="2.3.1",
127141
license="Apache 2.0",
128142
author="source{d}",
129143
author_email="language-analysis@sourced.tech",

0 commit comments

Comments
 (0)