Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved pyskycoin to lib/swig #178

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from
16 changes: 13 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,30 +1,39 @@
# general things to ignore
lib/swig/build/
build/
lib/swig/dist/
dist/
*.egg-info/
*.egg
*.eggs
*.py[cod]
lib/swig/__pycache__/
__pycache__/
lib/swig/.pytest_cache
.pytest_cache
*.so
*.o
*.orig
lib/swig/Pyskycoin-*
Pyskycoin-*
lib/swig/eggs
eggs
lib/swig/wheelhouse/
wheelhouse/

*fuse*
*~

#Copy of libskycoin.h in pyskycoin
swig/include/libskycoin.h
lib/swig/swig/include/libskycoin.h

#Just for testing outside tox
tests/mytest.py
lib/swig/tests/mytest.py

# due to using tox and pytest
.tox
lib/swig/.tox
.cache
lib/swig/.cache

# Temp files
*.swp
Expand All @@ -44,3 +53,4 @@ swig/pyskycoin_wrap.c
core*
qemu_*
venv
.venv
70 changes: 35 additions & 35 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ SHELL := /bin/bash
PYTHON_BIN ?= python$(PYTHON)
MKFILE_PATH = $(abspath $(lastword $(MAKEFILE_LIST)))
REPO_ROOT = $(dir $(MKFILE_PATH))
GOPATH_DIR = gopath
GOPATH_DIR = $(REPO_ROOT)/gopath
SKYLIBC_DIR ?= $(GOPATH_DIR)/src/github.com/fibercrypto/libskyfiber
SKYCOIN_DIR ?= $(SKYLIBC_DIR)/vendor/github.com/skycoin/skycoin
SKYCOIN_DIR ?= $(SKYLIBC_DIR)/vendor/github.com/SkycoinProject/skycoin
SKYBUILD_DIR = $(SKYLIBC_DIR)/build
BUILDLIBC_DIR = $(SKYBUILD_DIR)/libskycoin
LIBC_DIR = $(SKYLIBC_DIR)/lib/cgo
LIBSWIG_DIR = swig
LIBSWIG_DIR = $(REPO_ROOT)/lib/swig/swig
LIBSWIG_PYSKYFIBER = $(REPO_ROOT)/lib/swig
BUILD_DIR = build
DIST_DIR = dist
BIN_DIR = $(SKYLIBC_DIR)/bin
Expand All @@ -27,7 +28,7 @@ SRC_FILES = $(shell find $(SKYCOIN_DIR)/src -type f -name "*.go")
SWIG_FILES = $(shell find $(LIBSWIG_DIR) -type f -name "*.i")
HEADER_FILES = $(shell find $(INCLUDE_DIR) -type f -name "*.h")

PYTHON_CLIENT_DIR = lib/skyapi
PYTHON_CLIENT_DIR = $(REPO_ROOT)/lib/skyapi

ifeq ($(shell uname -s),Linux)
TEMP_DIR = tmp
Expand All @@ -39,20 +40,19 @@ endif

configure: ## Configure build environment
echo "Configure build environment"
mkdir -p $(BUILD_DIR)/usr/tmp $(BUILD_DIR)/usr/lib $(BUILD_DIR)/usr/include
mkdir -p $(BUILDLIBC_DIR) $(BIN_DIR) $(INCLUDE_DIR)
mkdir -p $(DIST_DIR)
(cd $(LIBSWIG_PYSKYFIBER) && mkdir -p $(BUILD_DIR)/usr/tmp $(BUILD_DIR)/usr/lib $(BUILD_DIR)/usr/include)
(cd $(LIBSWIG_PYSKYFIBER) && mkdir -p $(BUILDLIBC_DIR) $(BIN_DIR) $(INCLUDE_DIR))
(cd $(LIBSWIG_PYSKYFIBER) && mkdir -p $(DIST_DIR))


build-libc: configure ## Build libskycoin C client library
echo "Build libskycoin C client library"
GOPATH="$(REPO_ROOT)/$(GOPATH_DIR)" make -C $(SKYLIBC_DIR) clean-libc
GOPATH="$(REPO_ROOT)/$(GOPATH_DIR)" make -C $(SKYLIBC_DIR) build-libc
rm -f swig/include/libskycoin.h
rm -f swig/include/swig.h
mkdir -p swig/include
cp $(SKYLIBC_DIR)/include/swig.h swig/include/
grep -v _Complex $(SKYLIBC_DIR)/include/libskycoin.h > swig/include/libskycoin.h
mkdir -p $(LIBSWIG_PYSKYFIBER)/include
rm -f $(LIBSWIG_PYSKYFIBER)/include/libskycoin.h
grep -v _Complex $(SKYLIBC_DIR)/include/libskycoin.h > $(LIBSWIG_PYSKYFIBER)/include/libskycoin.h
rm -f $(SKYLIBC_DIR)/include/libskycoin.h

build-swig: ## Generate Python C module from SWIG interfaces
echo "Generate Python C module from SWIG interfaces"
Expand All @@ -66,40 +66,40 @@ build-swig: ## Generate Python C module from SWIG interfaces
sed -i 's/#/%/g' $(LIBSWIG_DIR)/structs.i ;\
fi \
}
rm -fv skycoin/skycoin.py
rm -f swig/pyskycoin_wrap.c
rm -f swig/include/swig.h
swig -python -py3 -w501,505,401,302,509,451 -Iswig/include -I$(INCLUDE_DIR) -outdir ./skycoin/ -o swig/pyskycoin_wrap.c $(LIBSWIG_DIR)/pyskycoin.i
rm -fv $(LIBSWIG_PYSKYFIBER)/skycoin/skycoin.py
rm -f $(LIBSWIG_PYSKYFIBER)/pyskycoin_wrap.c
swig -python -py3 -w501,505,401,302,509,451 -I$(LIBSWIG_PYSKYFIBER)/include/ -I$(INCLUDE_DIR) -outdir $(LIBSWIG_PYSKYFIBER)/skycoin/ -o $(LIBSWIG_PYSKYFIBER)/pyskycoin_wrap.c $(LIBSWIG_DIR)/pyskycoin.i

develop: ## Install PySkycoin for development
$(PYTHON_BIN) setup.py develop
(cd $(LIBSWIG_PYSKYFIBER) && REPO_ROOT=$(REPO_ROOT) $(PYTHON_BIN) setup.py develop)
(cd $(PYTHON_CLIENT_DIR) && $(PYTHON_BIN) setup.py develop)

build-libc-swig: build-libc build-swig

build: build-libc-swig ## Build PySkycoin Python package
$(PYTHON_BIN) setup.py build
(cd $(LIBSWIG_PYSKYFIBER) && REPO_ROOT=$(REPO_ROOT) $(PYTHON_BIN) setup.py build)
(cd $(PYTHON_CLIENT_DIR) && $(PYTHON_BIN) setup.py build)

test-ci: build-libc build-swig develop ## Run tests on (Travis) CI build
tox
(cd $(PYTHON_CLIENT_DIR) && tox)
(cd $(LIBSWIG_PYSKYFIBER) && REPO_ROOT=$(REPO_ROOT) tox)
# (cd $(PYTHON_CLIENT_DIR) && tox)


test-skyapi: build-libc build-swig develop ## Run project test suite by skyapi
(cd $(PYTHON_CLIENT_DIR) && $(PYTHON_BIN) setup.py test)

test-libsky: build-libc build-swig develop ## Run project test suite by pyskycoin
echo "Run project test suite by pyskycoin"
$(PYTHON_BIN) setup.py test
(cd $(LIBSWIG_PYSKYFIBER) && REPO_ROOT=$(REPO_ROOT) $(PYTHON_BIN) setup.py test)

test: test-skyapi test-libsky ## Run project test suite

sdist: ## Create source distribution archive
$(PYTHON_BIN) setup.py sdist --formats=gztar
(cd $(LIBSWIG_PYSKYFIBER) && $(PYTHON_BIN) setup.py sdist --formats=gztar)
(cd $(PYTHON_CLIENT_DIR) && $(PYTHON_BIN) setup.py sdist --formats=gztar)

bdist_wheel: ## Create architecture-specific binary wheel distribution archive
$(PYTHON_BIN) setup.py bdist_wheel
(cd $(LIBSWIG_PYSKYFIBER) && $(PYTHON_BIN) setup.py bdist_wheel)
(cd $(PYTHON_CLIENT_DIR) && $(PYTHON_BIN) setup.py bdist_wheel)

# FIXME: After libskycoin 32-bits binaries add bdist_manylinux_i686
Expand Down Expand Up @@ -134,23 +134,23 @@ check-dist: dist ## Perform self-tests upon distributions archives
docker run --rm -t -v $(REPO_ROOT):/io quay.io/pypa/manylinux1_i686 linux32 /io/.travis/check_wheels.sh

format: ## Format code that autopep8
autopep8 --in-place --aggressive --aggressive --aggressive --aggressive ./tests/*.py
(cd $(LIBSWIG_PYSKYFIBER) && autopep8 --in-place --aggressive --aggressive --aggressive --aggressive ./tests/*.py)

lint: ## Linter to pylint
pylint -E tests/*.py
(cd $(LIBSWIG_PYSKYFIBER) && pylint -E tests/*.py)
yamllint -d relaxed .travis.yml

clean: #Clean all
make -C $(SKYLIBC_DIR) clean-libc
$(PYTHON_BIN) -m pip uninstall -y pyskycoin
$(PYTHON_BIN) -m pip uninstall -y skyapi
rm -rfv tests/__pycache__
rm -rfv skycoin/__pycache__
rm -rfv skycoin/*.pyc
rm -rfv tests/*.pyc
rm -rfv tests/utils/*.pyc
rm -rfv tests/utils/__pycache__
rm -rfv *.so
rm -rfv $(LIBSWIG_PYSKYFIBER)/tests/__pycache__
rm -rfv $(LIBSWIG_PYSKYFIBER)/skycoin/__pycache__
rm -rfv $(LIBSWIG_PYSKYFIBER)/skycoin/*.pyc
rm -rfv $(LIBSWIG_PYSKYFIBER)/tests/*.pyc
rm -rfv $(LIBSWIG_PYSKYFIBER)/tests/utils/*.pyc
rm -rfv $(LIBSWIG_PYSKYFIBER)/tests/utils/__pycache__
rm -rfv $(LIBSWIG_PYSKYFIBER)/*.so
rm -rfv qemu_python_*
rm -rfv lib/skyapi/skyapi/__pycache__
rm -rfv lib/skyapi/skyapi/*.pyc
Expand All @@ -160,9 +160,9 @@ clean: #Clean all
rm -rfv lib/skyapi/skyapi/api/__pycache__
rm -rfv lib/skyapi/test/__pycache__
rm -rfv lib/skyapi/test/*.pyc
rm -rfv swig/pyskycoin_wrap.c
rm -rfv skycoin/skycoin.py
$(PYTHON_BIN) setup.py clean
rm -rfv $(LIBSWIG_PYSKYFIBER)/swig/pyskycoin_wrap.c
rm -rfv $(LIBSWIG_PYSKYFIBER)/skycoin/skycoin.py
$(PYTHON_BIN) $(LIBSWIG_PYSKYFIBER)/setup.py clean


help: ## List available commands
Expand Down
File renamed without changes.
File renamed without changes.
Empty file added lib/swig/include/libskycoin.h
Empty file.