Compare commits
1 Commits
develop
...
new-versio
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f2d8bb84b2 |
12
Makefile
12
Makefile
@@ -8,6 +8,12 @@ install:
|
|||||||
$(MAKE) -C $(PYP_DIR) install
|
$(MAKE) -C $(PYP_DIR) install
|
||||||
$(MAKE) -C $(EXT_DIR) install
|
$(MAKE) -C $(EXT_DIR) install
|
||||||
|
|
||||||
testinstalled:
|
test:
|
||||||
$(MAKE) -C $(PYP_DIR) testinstalled
|
$(MAKE) -C $(PYP_DIR) test
|
||||||
$(MAKE) -C $(EXT_DIR) installcheck
|
$(MAKE) -C $(EXT_DIR) test
|
||||||
|
|
||||||
|
release: install
|
||||||
|
$(MAKE) -C $(EXT_DIR) release
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
echo 'not yet implemented'
|
||||||
|
|||||||
@@ -40,7 +40,14 @@ Update local installation with `sudo make install`
|
|||||||
|
|
||||||
Run the tests with `PGUSER=postgres make test`
|
Run the tests with `PGUSER=postgres make test`
|
||||||
|
|
||||||
Update extension in working database with
|
The commands mentioned, executed from the top directory,
|
||||||
|
install and test both the Pyhton package and the PostgreSQL extension.
|
||||||
|
|
||||||
|
When developing the Pyhon package, it can be
|
||||||
|
installed and tested in its own from the `src/pg` directory with the same commands.
|
||||||
|
|
||||||
|
When a new development extension has beeen installed it is available
|
||||||
|
in PostgreSQL; update extension in any specific database with
|
||||||
|
|
||||||
* `ALTER EXTENSION crankshaft VERSION TO 'current';`
|
* `ALTER EXTENSION crankshaft VERSION TO 'current';`
|
||||||
`ALTER EXTENSION crankshaft VERSION TO 'dev';`
|
`ALTER EXTENSION crankshaft VERSION TO 'dev';`
|
||||||
|
|||||||
0
release/.gitignore
vendored
Normal file
0
release/.gitignore
vendored
Normal file
@@ -16,7 +16,7 @@ DATA = $(EXTENSION)--dev.sql \
|
|||||||
SOURCES_DATA_DIR = sql
|
SOURCES_DATA_DIR = sql
|
||||||
SOURCES_DATA = $(wildcard $(SOURCES_DATA_DIR)/*.sql)
|
SOURCES_DATA = $(wildcard $(SOURCES_DATA_DIR)/*.sql)
|
||||||
|
|
||||||
VIRTUALENV_PATH = $(realpath ../py/)
|
VIRTUALENV_PATH = $(realpath ../py/environment)
|
||||||
ESC_VIRVIRTUALENV_PATH = $(subst /,\/,$(VIRTUALENV_PATH))
|
ESC_VIRVIRTUALENV_PATH = $(subst /,\/,$(VIRTUALENV_PATH))
|
||||||
|
|
||||||
REPLACEMENTS = -e 's/@@VERSION@@/$(EXTVERSION)/g' \
|
REPLACEMENTS = -e 's/@@VERSION@@/$(EXTVERSION)/g' \
|
||||||
@@ -41,8 +41,26 @@ all: $(DATA)
|
|||||||
|
|
||||||
EXTVERSION = $(shell grep default_version $(EXTENSION).control | sed -e "s/default_version[[:space:]]*=[[:space:]]*'\([^']*\)'/\1/")
|
EXTVERSION = $(shell grep default_version $(EXTENSION).control | sed -e "s/default_version[[:space:]]*=[[:space:]]*'\([^']*\)'/\1/")
|
||||||
|
|
||||||
../release/$(EXTENSION).control: $(EXTENSION).control
|
RELEASED_PACKAGE = crankshaft_$(subst .,_,$(EXTVERSION))
|
||||||
|
|
||||||
|
RELEASE_REPLACEMENTS = -e 's/import\scrankshaft/import $(RELEASED_PACKAGE)/g' \
|
||||||
|
-e 's/from\scrankshaft/from $(RELEASED_PACKAGE)/g'
|
||||||
|
|
||||||
|
../../release/$(EXTENSION).control: $(EXTENSION).control
|
||||||
cp $< $@
|
cp $< $@
|
||||||
|
|
||||||
release: ../release/$(EXTENSION).control
|
release: ../../release/$(EXTENSION).control
|
||||||
cp $(EXTENSION)--dev.sql $(EXTENSION)--$(EXTVERSION).sql
|
# ALTERNATIVE: use release virtualenv; copy here files from src replacing VIRTUALENV_PATH
|
||||||
|
$(SED) $(RELEASE_REPLACEMENTS) $(EXTENSION)--dev.sql > ../../release/$(EXTENSION)--$(EXTVERSION).sql
|
||||||
|
cp -r ../py/crankshaft ../../release/$(RELEASED_PACKAGE)
|
||||||
|
$(SED) -i -e 's/name='"'"'crankshaft'"'"'/name='"'"'$(RELEASED_PACKAGE)'"'"'/g' ../../release/$(RELEASED_PACKAGE)/setup.py
|
||||||
|
|
||||||
|
install_release:
|
||||||
|
$(INSTALL_DATA) ../../release/$(EXTENSION).control '$(DESTDIR)$(datadir)/extension/'
|
||||||
|
$(INSTALL_DATA) ../../release/*.sql '$(DESTDIR)$(datadir)/extension/'
|
||||||
|
# virtualenv --system-site-packages ../py/dev
|
||||||
|
../py/environment/bin/pip install -I -U ../../release/$(RELEASED_PACKAGE)
|
||||||
|
../py/environment/bin/pip install -I nose
|
||||||
|
|
||||||
|
test: export PGUSER=postgres
|
||||||
|
test: installcheck
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
CREATE OR REPLACE FUNCTION _cdb_crankshaft_virtualenvs_path()
|
CREATE OR REPLACE FUNCTION _cdb_crankshaft_virtualenv_path()
|
||||||
RETURNS text
|
RETURNS text
|
||||||
AS $$
|
AS $$
|
||||||
BEGIN
|
BEGIN
|
||||||
@@ -14,9 +14,7 @@ AS $$
|
|||||||
import os
|
import os
|
||||||
# plpy.notice('%',str(os.environ))
|
# plpy.notice('%',str(os.environ))
|
||||||
# activate virtualenv
|
# activate virtualenv
|
||||||
crankshaft_version = plpy.execute('SELECT cdb_crankshaft.cdb_crankshaft_internal_version()')[0]['cdb_crankshaft_internal_version']
|
default_venv_path = plpy.execute('SELECT cdb_crankshaft._cdb_crankshaft_virtualenv_path()')[0]['_cdb_crankshaft_virtualenv_path']
|
||||||
base_path = plpy.execute('SELECT cdb_crankshaft._cdb_crankshaft_virtualenvs_path()')[0]['_cdb_crankshaft_virtualenvs_path']
|
|
||||||
default_venv_path = os.path.join(base_path, crankshaft_version)
|
|
||||||
venv_path = os.environ.get('CRANKSHAFT_VENV', default_venv_path)
|
venv_path = os.environ.get('CRANKSHAFT_VENV', default_venv_path)
|
||||||
activate_path = venv_path + '/bin/activate_this.py'
|
activate_path = venv_path + '/bin/activate_this.py'
|
||||||
exec(open(activate_path).read(), dict(__file__=activate_path))
|
exec(open(activate_path).read(), dict(__file__=activate_path))
|
||||||
|
|||||||
2
src/py/.gitignore
vendored
2
src/py/.gitignore
vendored
@@ -1,2 +1,2 @@
|
|||||||
*.pyc
|
*.pyc
|
||||||
dev/
|
environment/
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
# Install the package locally for development
|
# Install the package locally for development
|
||||||
install:
|
install:
|
||||||
virtualenv --system-site-packages dev
|
virtualenv --system-site-packages environment
|
||||||
./dev/bin/pip install -I ./crankshaft
|
./environment/bin/pip install -I -U ./crankshaft
|
||||||
./dev/bin/pip install -I nose
|
./environment/bin/pip install -I nose
|
||||||
|
|
||||||
# Test develpment install
|
# Test develpment install
|
||||||
testinstalled:
|
test:
|
||||||
./dev/bin/nosetests crankshaft/test/
|
./environment/bin/nosetests crankshaft/test/
|
||||||
|
|||||||
Reference in New Issue
Block a user