Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ include DCO
include LICENSE
include MAINTAINERS
include Makefile
include github.com/gogo/protobuf/gogoproto/gogo.proto
include gopkg.in/bblfsh/sdk.v1/protocol/generated.proto
include gopkg.in/bblfsh/sdk.v1/uast/generated.proto
prune bblfsh/libuast
2 changes: 1 addition & 1 deletion bblfsh/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def setup():
return args

def run_query(root, query, mapn, as_array):
result = filter(root, query)
result = list(filter(root, query))

if not result:
print("Nothing found")
Expand Down
34 changes: 24 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,33 @@
import sys

from setuptools import setup, find_packages, Extension
from setuptools.command.build_ext import build_ext

LIBUAST_VERSION = "v1.3.0"
SDK_VERSION = "v1.4.2"
SDK_MAJOR = SDK_VERSION.split('.')[0]
PYTHON = "python3"


libraries = ['xml2']
sources = ['bblfsh/pyuast.c']


class CustomBuildExt(build_ext):
def run(self):
global libraries
global sources

if "--global-uast" in sys.argv:
libraries.append('uast')
else:
sources.append('bblfsh/libuast/uast.c')
sources.append('bblfsh/libuast/roles.c')

getLibuast()
build_ext.run(self)


def runc(cmd):
cmd = cmd.format(**globals())
print(cmd)
Expand Down Expand Up @@ -90,9 +110,6 @@ def clean():


def main():
libraries = ['xml2']
sources = ['bblfsh/pyuast.c']

# The --global-uast flag allows to install the python driver using the installed uast library
if "--getdeps" in sys.argv:
doGetDeps()
Expand All @@ -102,12 +119,6 @@ def main():
clean()
sys.exit(0)

if "--global-uast" in sys.argv:
libraries.append('uast')
else:
sources.append('bblfsh/libuast/uast.c')
sources.append('bblfsh/libuast/roles.c')

# download c dependencies
if not os.path.exists("bblfsh/libuast"):
doGetDeps()
Expand All @@ -121,9 +132,12 @@ def main():
'/usr/include', '/usr/include/libxml2'], sources=sources)

setup(
cmdclass = {
"build_ext": CustomBuildExt,
},
name="bblfsh",
description="Fetches Universal Abstract Syntax Trees from Babelfish.",
version="2.3.0",
version="2.3.1",
license="Apache 2.0",
author="source{d}",
author_email="[email protected]",
Expand Down