Implement release with variant python package names
Instead of having to use different virtual environments for development and for each version to be used in development here we're using differnt names for each release's python package. There a pending problem here: pip replaces underscores in the package name by dashes when installing it.
This commit is contained in:
parent
0206cc6c44
commit
f2d8bb84b2
12
Makefile
12
Makefile
@ -8,6 +8,12 @@ install:
|
||||
$(MAKE) -C $(PYP_DIR) install
|
||||
$(MAKE) -C $(EXT_DIR) install
|
||||
|
||||
testinstalled:
|
||||
$(MAKE) -C $(PYP_DIR) testinstalled
|
||||
$(MAKE) -C $(EXT_DIR) installcheck
|
||||
test:
|
||||
$(MAKE) -C $(PYP_DIR) test
|
||||
$(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`
|
||||
|
||||
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 '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 = $(wildcard $(SOURCES_DATA_DIR)/*.sql)
|
||||
|
||||
VIRTUALENV_PATH = $(realpath ../py/)
|
||||
VIRTUALENV_PATH = $(realpath ../py/environment)
|
||||
ESC_VIRVIRTUALENV_PATH = $(subst /,\/,$(VIRTUALENV_PATH))
|
||||
|
||||
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/")
|
||||
|
||||
../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 $< $@
|
||||
|
||||
release: ../release/$(EXTENSION).control
|
||||
cp $(EXTENSION)--dev.sql $(EXTENSION)--$(EXTVERSION).sql
|
||||
release: ../../release/$(EXTENSION).control
|
||||
# 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
|
||||
AS $$
|
||||
BEGIN
|
||||
@ -14,9 +14,7 @@ AS $$
|
||||
import os
|
||||
# plpy.notice('%',str(os.environ))
|
||||
# activate virtualenv
|
||||
crankshaft_version = plpy.execute('SELECT cdb_crankshaft.cdb_crankshaft_internal_version()')[0]['cdb_crankshaft_internal_version']
|
||||
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)
|
||||
default_venv_path = plpy.execute('SELECT cdb_crankshaft._cdb_crankshaft_virtualenv_path()')[0]['_cdb_crankshaft_virtualenv_path']
|
||||
venv_path = os.environ.get('CRANKSHAFT_VENV', default_venv_path)
|
||||
activate_path = venv_path + '/bin/activate_this.py'
|
||||
exec(open(activate_path).read(), dict(__file__=activate_path))
|
||||
|
2
src/py/.gitignore
vendored
2
src/py/.gitignore
vendored
@ -1,2 +1,2 @@
|
||||
*.pyc
|
||||
dev/
|
||||
environment/
|
||||
|
@ -1,9 +1,9 @@
|
||||
# Install the package locally for development
|
||||
install:
|
||||
virtualenv --system-site-packages dev
|
||||
./dev/bin/pip install -I ./crankshaft
|
||||
./dev/bin/pip install -I nose
|
||||
virtualenv --system-site-packages environment
|
||||
./environment/bin/pip install -I -U ./crankshaft
|
||||
./environment/bin/pip install -I nose
|
||||
|
||||
# Test develpment install
|
||||
testinstalled:
|
||||
./dev/bin/nosetests crankshaft/test/
|
||||
test:
|
||||
./environment/bin/nosetests crankshaft/test/
|
||||
|
Loading…
Reference in New Issue
Block a user