Skip to content

Commit 8cb1158

Browse files
committed
fix makefile
1 parent 00d5e0b commit 8cb1158

File tree

2 files changed

+24
-18
lines changed

2 files changed

+24
-18
lines changed

CONTRIBUTING.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Contributing
22
------------------
3-
Anyone can contribute, be it by coding, improving docs or just proposing a new feature.
3+
Anyone can contribute, be it by coding, improving docs or just proposing a new feature.
44
As a new contributor, you may want to have a look at some of the following issues:
5-
* [**good first issue**](https://github.com/objectbox/objectbox-python/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) tag
5+
* [**good first issue**](https://github.com/objectbox/objectbox-python/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) tag
66
* [**help wanted**](https://github.com/objectbox/objectbox-python/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) tag
77

8-
When picking up an existing issue, please let others know in the issue comment.
8+
When picking up an existing issue, please let others know in the issue comment.
99
Don't hesitate to reach out for guidance or to discuss a solution proposal!
1010

1111
### Code contributions
@@ -16,20 +16,20 @@ When creating a Pull Request for code changes, please check that you cover the f
1616
### Basic technical approach
1717
ObjectBox offers a [C API](https://github.com/objectbox/objectbox-c) which can be integrated into python using
1818
[ctypes](https://docs.python.org/dev/library/ctypes.html).
19-
The C API is is also used by the ObjectBox language bindings for [Go](https://github.com/objectbox/objectbox-go),
19+
The C API is is also used by the ObjectBox language bindings for [Go](https://github.com/objectbox/objectbox-go),
2020
[Swift](https://github.com/objectbox/objectbox-swift), and [Dart/Flutter](https://github.com/objectbox/objectbox-dart).
2121
These language bindings currently serve as an example for this Python implementation.
2222
Internally, ObjectBox uses [FlatBuffers](https://google.github.io/flatbuffers/) to store objects.
2323

24-
The main prerequisite to using the Python APIs is the ObjectBox binary library (.so, .dylib, .dll depending on your
25-
platform) which actually implements the database functionality. The library should be placed in the
26-
`objectbox/lib/[architecture]/` folder of the checked out repository. You can get/update it by running `make get-lib`.
24+
The main prerequisite to using the Python APIs is the ObjectBox binary library (.so, .dylib, .dll depending on your
25+
platform) which actually implements the database functionality. The library should be placed in the
26+
`objectbox/lib/[architecture]/` folder of the checked out repository. You can get/update it by running `make depend`.
2727

2828
### Getting started as a contributor
2929
#### Initial setup
3030
If you're just getting started, run the following simple steps to set up the repository on your machine
3131
* clone this repository
32-
* `pip install virtualenv` install [virtualenv](https://pypi.org/project/virtualenv/) if you don't have it yet
32+
* `python3 -m pip install --user virtualenv` install [virtualenv](https://pypi.org/project/virtualenv/) if you don't have it yet
3333
* `make depend` to initialize `virtualenv` and get dependencies (objectbox-c shared library)
3434
* `make` to build and test
3535

Makefile

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
SHELL := /bin/bash
12
VENV = .venv
23
VENVBIN = ${VENV}/bin
4+
PYTHON = python3
5+
PIP = ${PYTHON} -m pip
36

47
# Detect windows - works on both 32 & 64-bit windows
58
ifeq ($(OS),Windows_NT)
@@ -9,7 +12,7 @@ endif
912
export PATH := $(abspath ${VENVBIN}):${PATH}
1013

1114

12-
.PHONY: init test build benchmark publish
15+
.PHONY: init test build benchmark publish ${VENV}-init
1316

1417
# Default target executed when no arguments are given to make.
1518
default_target: build test
@@ -22,33 +25,36 @@ help: ## Show this help
2225
all: depend build test ## Get dependencies, clean, build and test
2326

2427
build: ${VENV} clean ## Clean and build
25-
python setup.py bdist_wheel
28+
${PYTHON} setup.py bdist_wheel
2629
ls -lh dist
2730

2831
${VENV}: ${VENVBIN}/activate
2932

30-
${VENVBIN}/activate: requirements.txt
31-
virtualenv ${VENV}
33+
${VENV}-init:
34+
if [ ! -d "${VENV}" ] ; then ${PYTHON} -m virtualenv ${VENV} ; fi
35+
3236
# remove packages not in the requirements.txt
33-
pip3 freeze | grep -v -f requirements.txt - | grep -v '^#' | grep -v '^-e ' | xargs pip3 uninstall -y || echo "never mind"
3437
# install and upgrade based on the requirements.txt
35-
python -m pip install --upgrade -r requirements.txt
3638
# let make know this is the last time requirements changed
39+
${VENVBIN}/activate: ${VENV}-init requirements.txt
40+
set -e ; \
41+
${PIP} freeze | grep -v -f requirements.txt - | grep -v '^#' | grep -v '^-e ' | xargs ${PIP} uninstall -y || echo "never mind" ; \
42+
${PIP} install --upgrade -r requirements.txt ; \
3743
touch ${VENVBIN}/activate
3844

3945
depend: ${VENV} ## Prepare dependencies
40-
python download-c-lib.py
46+
${PYTHON} download-c-lib.py
4147

4248
test: ${VENV} ## Test all targets
43-
python -m pytest --capture=no --verbose
49+
${PYTHON} -m pytest --capture=no --verbose
4450

4551
benchmark: ${VENV} ## Run CRUD benchmarks
46-
python -m benchmark
52+
${PYTHON} -m benchmark
4753

4854
clean: ## Clean build artifacts
4955
rm -rf build/
5056
rm -rf dist/
5157
rm -rf *.egg-info
5258

5359
publish: ## Publish the package built by `make build`
54-
python -m twine upload --verbose dist/objectbox*.whl
60+
${PYTHON} -m twine upload --verbose dist/objectbox*.whl

0 commit comments

Comments
 (0)