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

Commit

Permalink
Merge pull request #154 from juanjux/bip-5
Browse files Browse the repository at this point in the history
Migration to the new DSL
  • Loading branch information
juanjux authored Jun 1, 2018
2 parents 6629fad + 0d46f9c commit 19ec088
Show file tree
Hide file tree
Showing 120 changed files with 29,876 additions and 25,463 deletions.
116 changes: 6 additions & 110 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,111 +1,7 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# dotenv
.env

# virtualenv
venv/
ENV/

# Spyder project settings
.spyderproject

# Rope project settings
.ropeproject

.idea/*

test/nimcache/*
test/sendmsg

# pycharm
.idea/*

# virtualenv
36env/*
install.sh
mypy/*

Dockerfile

.sdk/*
driver/main
main
.local/*

.sdk
build
.mypy_cache
.local/*
.cache/*
__pycache__
makebuild.sh
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
- docker

before_script:
- go get -v gopkg.in/bblfsh/sdk.v1/...
- go get -v gopkg.in/bblfsh/sdk.v2/...
- bblfsh-sdk prepare-build .
- go get -v -t ./driver/...

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.build.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ FROM alpine:3.7
RUN mkdir -p /opt/driver/src && \
adduser $BUILD_USER -u $BUILD_UID -D -h /opt/driver/src

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

WORKDIR /opt/driver/src
2 changes: 1 addition & 1 deletion Dockerfile.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ MAINTAINER source{d}

ARG DEVDEPS=native/dev_deps
ARG CONTAINER_DEVDEPS=/tmp/dev_deps
ARG PYDETECTOR_VER=0.14.2
ARG PYDETECTOR_VER=0.14.3

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

Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ DEV_DEPS ?= native/dev_deps

test-native-internal:
pip3 install --user ${DEV_DEPS}/python-pydetector/ || pip3 install --user pydetector-bblfsh
pip2 install --user ${DEV_DEPS}/python-pydetector/ || pip2 install --user pydetector-bblfsh
cd native/python_package/test && \
python3 -m unittest discover

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


include .sdk/Makefile
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Development Environment

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

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.
Expand Down
34 changes: 34 additions & 0 deletions driver/fixtures/fixtures_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package fixtures

import (
"path/filepath"
"testing"

"github.com/bblfsh/python-driver/driver/normalizer"
"gopkg.in/bblfsh/sdk.v2/sdk/driver"
"gopkg.in/bblfsh/sdk.v2/sdk/driver/fixtures"
)

const projectRoot = "../../"

var Suite = &fixtures.Suite{
Lang: "python",
Ext: ".py",
Path: filepath.Join(projectRoot, fixtures.Dir),
NewDriver: func() driver.BaseDriver {
return driver.NewExecDriverAt(filepath.Join(projectRoot, "build/bin/native"))
},
Transforms: driver.Transforms{
Native: normalizer.Native,
Code: normalizer.Code,
},
BenchName: "issue_server101",
}

func TestPythonDriver(t *testing.T) {
Suite.RunTests(t)
}

func BenchmarkPythonDriver(b *testing.B) {
Suite.RunBenchmarks(b)
}
8 changes: 8 additions & 0 deletions driver/impl/impl.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package impl

import "gopkg.in/bblfsh/sdk.v2/sdk/driver"

func init() {
// Can be overridden to link a native driver into a Go driver server.
driver.DefaultDriver = driver.NewExecDriver()
}
8 changes: 6 additions & 2 deletions driver/main.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package main

import (
_ "github.com/bblfsh/python-driver/driver/impl"
"github.com/bblfsh/python-driver/driver/normalizer"

"gopkg.in/bblfsh/sdk.v1/sdk/driver"
"gopkg.in/bblfsh/sdk.v2/sdk/driver"
)

func main() {
driver.Run(normalizer.ToNode, normalizer.Transformers)
driver.Run(driver.Transforms{
Native: normalizer.Native,
Code: normalizer.Code,
})
}
Loading

0 comments on commit 19ec088

Please sign in to comment.