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

Commit 19ec088

Browse files
authored
Merge pull request #154 from juanjux/bip-5
Migration to the new DSL
2 parents 6629fad + 0d46f9c commit 19ec088

File tree

120 files changed

+29876
-25463
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+29876
-25463
lines changed

.gitignore

Lines changed: 6 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,7 @@
1-
# Byte-compiled / optimized / DLL files
2-
__pycache__/
3-
*.py[cod]
4-
*$py.class
5-
6-
# C extensions
7-
*.so
8-
9-
# Distribution / packaging
10-
.Python
11-
env/
12-
build/
13-
develop-eggs/
14-
dist/
15-
downloads/
16-
eggs/
17-
.eggs/
18-
lib/
19-
lib64/
20-
parts/
21-
sdist/
22-
var/
23-
*.egg-info/
24-
.installed.cfg
25-
*.egg
26-
27-
# PyInstaller
28-
# Usually these files are written by a python script from a template
29-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
30-
*.manifest
31-
*.spec
32-
33-
# Installer logs
34-
pip-log.txt
35-
pip-delete-this-directory.txt
36-
37-
# Unit test / coverage reports
38-
htmlcov/
39-
.tox/
40-
.coverage
41-
.coverage.*
42-
.cache
43-
nosetests.xml
44-
coverage.xml
45-
*,cover
46-
.hypothesis/
47-
48-
# Translations
49-
*.mo
50-
*.pot
51-
52-
# Django stuff:
53-
*.log
54-
local_settings.py
55-
56-
# Flask stuff:
57-
instance/
58-
.webassets-cache
59-
60-
# Scrapy stuff:
61-
.scrapy
62-
63-
# Sphinx documentation
64-
docs/_build/
65-
66-
# PyBuilder
67-
target/
68-
69-
# IPython Notebook
70-
.ipynb_checkpoints
71-
72-
# pyenv
73-
.python-version
74-
75-
# celery beat schedule file
76-
celerybeat-schedule
77-
78-
# dotenv
79-
.env
80-
81-
# virtualenv
82-
venv/
83-
ENV/
84-
85-
# Spyder project settings
86-
.spyderproject
87-
88-
# Rope project settings
89-
.ropeproject
90-
91-
.idea/*
92-
93-
test/nimcache/*
94-
test/sendmsg
95-
96-
# pycharm
97-
.idea/*
98-
99-
# virtualenv
100-
36env/*
101-
install.sh
102-
mypy/*
103-
104-
Dockerfile
105-
106-
.sdk/*
107-
driver/main
108-
main
109-
.local/*
110-
1+
.sdk
2+
build
1113
.mypy_cache
4+
.local/*
5+
.cache/*
6+
__pycache__
7+
makebuild.sh

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ services:
77
- docker
88

99
before_script:
10-
- go get -v gopkg.in/bblfsh/sdk.v1/...
10+
- go get -v gopkg.in/bblfsh/sdk.v2/...
1111
- bblfsh-sdk prepare-build .
1212
- go get -v -t ./driver/...
1313

Dockerfile.build.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ FROM alpine:3.7
33
RUN mkdir -p /opt/driver/src && \
44
adduser $BUILD_USER -u $BUILD_UID -D -h /opt/driver/src
55

6-
RUN apk add --no-cache --update python python3 git make
6+
RUN apk add --no-cache --update python python3 py-pip py2-pip git make
77

88
WORKDIR /opt/driver/src

Dockerfile.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ MAINTAINER source{d}
33

44
ARG DEVDEPS=native/dev_deps
55
ARG CONTAINER_DEVDEPS=/tmp/dev_deps
6-
ARG PYDETECTOR_VER=0.14.2
6+
ARG PYDETECTOR_VER=0.14.3
77

88
RUN apk add --no-cache --update python python3 py-pip py2-pip git
99

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ DEV_DEPS ?= native/dev_deps
22

33
test-native-internal:
44
pip3 install --user ${DEV_DEPS}/python-pydetector/ || pip3 install --user pydetector-bblfsh
5+
pip2 install --user ${DEV_DEPS}/python-pydetector/ || pip2 install --user pydetector-bblfsh
56
cd native/python_package/test && \
67
python3 -m unittest discover
78

89
build-native-internal:
910
pip3 install --user ${DEV_DEPS}/python-pydetector/ || pip3 install --user pydetector-bblfsh
10-
cd native/python_package/ && \
11-
pip3 install -U --user .
11+
pip2 install --user ${DEV_DEPS}/python-pydetector/ || pip2 install --user pydetector-bblfsh
12+
cd native/python_package/ && pip3 install -U --user .
1213
cp native/sh/native.sh $(BUILD_PATH)/bin/native;
1314
chmod +x $(BUILD_PATH)/bin/native
1415

15-
1616
include .sdk/Makefile

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Development Environment
77

88
Requirements:
99
- `docker`
10-
- [`bblfsh-sdk`](https://github.com/bblfsh/sdk) _(go get -u gopkg.in/bblfsh/sdk.v1/...)_
10+
- [`bblfsh-sdk`](https://github.com/bblfsh/sdk) _(go get -u gopkg.in/bblfsh/sdk.v2/...)_
1111
- UAST converter dependencies _(go get -t -v ./...)_
1212

1313
To initialize the build system execute: `bblfsh-sdk prepare-build`, at the root of the project. This will install the SDK at `.sdk` for this driver.

driver/fixtures/fixtures_test.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package fixtures
2+
3+
import (
4+
"path/filepath"
5+
"testing"
6+
7+
"github.com/bblfsh/python-driver/driver/normalizer"
8+
"gopkg.in/bblfsh/sdk.v2/sdk/driver"
9+
"gopkg.in/bblfsh/sdk.v2/sdk/driver/fixtures"
10+
)
11+
12+
const projectRoot = "../../"
13+
14+
var Suite = &fixtures.Suite{
15+
Lang: "python",
16+
Ext: ".py",
17+
Path: filepath.Join(projectRoot, fixtures.Dir),
18+
NewDriver: func() driver.BaseDriver {
19+
return driver.NewExecDriverAt(filepath.Join(projectRoot, "build/bin/native"))
20+
},
21+
Transforms: driver.Transforms{
22+
Native: normalizer.Native,
23+
Code: normalizer.Code,
24+
},
25+
BenchName: "issue_server101",
26+
}
27+
28+
func TestPythonDriver(t *testing.T) {
29+
Suite.RunTests(t)
30+
}
31+
32+
func BenchmarkPythonDriver(b *testing.B) {
33+
Suite.RunBenchmarks(b)
34+
}

driver/impl/impl.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package impl
2+
3+
import "gopkg.in/bblfsh/sdk.v2/sdk/driver"
4+
5+
func init() {
6+
// Can be overridden to link a native driver into a Go driver server.
7+
driver.DefaultDriver = driver.NewExecDriver()
8+
}

driver/main.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
package main
22

33
import (
4+
_ "github.com/bblfsh/python-driver/driver/impl"
45
"github.com/bblfsh/python-driver/driver/normalizer"
56

6-
"gopkg.in/bblfsh/sdk.v1/sdk/driver"
7+
"gopkg.in/bblfsh/sdk.v2/sdk/driver"
78
)
89

910
func main() {
10-
driver.Run(normalizer.ToNode, normalizer.Transformers)
11+
driver.Run(driver.Transforms{
12+
Native: normalizer.Native,
13+
Code: normalizer.Code,
14+
})
1115
}

0 commit comments

Comments
 (0)