From dfdbacfb30899bedf700d6a1355c8ac22f0634d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Mar=C3=ADn?= Date: Thu, 19 Dec 2019 15:22:44 +0100 Subject: [PATCH] WIP: PG12 + Python3 compat --- CONTRIBUTING.md | 4 +--- Makefile | 4 ++-- Makefile.global | 15 +++++++++++++-- NEWS.md | 8 +++++++- README.md | 14 +++----------- RELEASE.md | 3 --- check-compatibility.sh | 6 +----- 7 files changed, 27 insertions(+), 27 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e478427..2665c07 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,9 +39,7 @@ ALTER EXTENSION crankshaft UPDATE TO 'dev'; If the extension has not previously been installed in a database, it can be installed directly with: ```sql -CREATE EXTENSION IF NOT EXISTS plpythonu; -CREATE EXTENSION IF NOT EXISTS postgis; -CREATE EXTENSION crankshaft WITH VERSION 'dev'; +CREATE EXTENSION crankshaft WITH VERSION 'dev' CASCADE; ``` Once the feature or bugfix is completed and all the tests are passing diff --git a/Makefile b/Makefile index 50f690c..26b25f4 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ test: ## Run the tests for the development version of the extension $(MAKE) -C $(EXT_DIR) test # Generate a new release into release -release: ## Generate a new release of the extension. Only for telease manager +release: ## Generate a new release of the extension. $(MAKE) -C $(EXT_DIR) release $(MAKE) -C $(PYP_DIR) release @@ -31,7 +31,7 @@ release: ## Generate a new release of the extension. Only for telease manager # Requires sudo. # Use the RELEASE_VERSION environment variable to deploy a specific version: # sudo make deploy RELEASE_VERSION=1.0.0 -deploy: ## Deploy a released extension. Only for release manager. Requires sudo. +deploy: $(MAKE) -C $(EXT_DIR) deploy $(MAKE) -C $(PYP_DIR) deploy diff --git a/Makefile.global b/Makefile.global index 135571b..257683f 100644 --- a/Makefile.global +++ b/Makefile.global @@ -3,9 +3,20 @@ EXTENSION = crankshaft PACKAGE = crankshaft EXTVERSION = $(shell grep default_version $(SELF_DIR)/src/pg/$(EXTENSION).control | sed -e "s/default_version[[:space:]]*=[[:space:]]*'\([^']*\)'/\1/") RELEASE_VERSION ?= $(EXTVERSION) + SED = sed -PIP = pip NOSETESTS = nosetests AWK = awk + PG_CONFIG = pg_config -PG_PARALLEL := $(shell $(PG_CONFIG) --version | ($(AWK) '{$$2*=1000; if ($$2 >= 9600) print 1; else print 0;}' 2> /dev/null || echo 0)) +PG_VERSION_1000 := $(shell $(PG_CONFIG) --version | $(AWK) '{$$2*=1000; print $$2}') +PG_PARALLEL := $(shell [ $(PG_VERSION_1000) -ge 9600 ] && echo true) + +PG_12plus := $(shell [ $(PG_VERSION_1000) -ge 12000 ] && echo true) +PYTHON3 ?= $(PG_12plus) + +ifeq ($(PYTHON3), true) +PIP := python3 -m pip +else +PIP := python2 -m pip +endif diff --git a/NEWS.md b/NEWS.md index db8fe27..b3c137f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,7 +1,13 @@ +0.9.0 (XXXX-XX-XX) +------------------ +* Compatibility with PG12. +* Compatibility with python3 (enable with PYTHON3=true env variable, default in PG12+). + + 0.8.2 (2019-02-07) ------------------ * Update dependencies to match what it's being used in production. -* Update travis to xenial, PG10 and 11, and postgis 2.6 +* Update travis to xenial, PG10 and 11, and postgis 2.5 * Compatibility with PG11 0.8.1 (2018-03-12) diff --git a/README.md b/README.md index 0b231a8..f7bbd62 100644 --- a/README.md +++ b/README.md @@ -8,28 +8,21 @@ CARTO Spatial Analysis extension for PostgreSQL. * `src/` source code - `pg/` contains the PostgreSQL extension source code - `py/` Python module source code -* `release` reseleased versions +* `release` released versions ## Requirements * PostgreSQL -* plpythonu and postgis extensions +* plpythonu (for PG12+, plpython3u) and postgis extensions * python-scipy system package (see [src/py/README.md](https://github.com/CartoDB/crankshaft/blob/develop/src/py/README.md)) # Development Process -We distinguish two roles: - -* *developers* will implement new functionality and bugfixes into - the codebase. -* A *release manager* will handle the release process. - We use the branch `develop` as the main integration branch for development. The `master` is reserved to handle releases. The process is as follows: -1. Create a new **topic branch** from `develop` for any new feature -or bugfix and commit their changes to it: +1. Create a new **topic branch** from `develop` for any new feature or bugfix and commit their changes to it: ```shell git fetch && git checkout -b my-cool-feature origin/develop @@ -39,7 +32,6 @@ or bugfix and commit their changes to it: 1. Update the [NEWS.md](https://github.com/CartoDB/crankshaft/blob/develop/NEWS.md) doc. 1. Create a pull request and mention relevant people for a **peer review**. 1. Address the comments and improvements you get from the peer review. -1. Mention `@CartoDB/dataservices` in the PR to get it merged into `develop`. In order for a pull request to be accepted, the following criteria should be met: * The peer review should pass and no major issue should be left unaddressed. diff --git a/RELEASE.md b/RELEASE.md index 44a9a2f..f814c82 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,8 +1,5 @@ # Release & Deployment Process -The release process of a new version of the extension -shall be performed by the designated *Release Manager*. - ## Release steps * Make sure `develop` branch passes all the tests. * Merge `develop` into `master` diff --git a/check-compatibility.sh b/check-compatibility.sh index 3b606e3..96e9b7f 100755 --- a/check-compatibility.sh +++ b/check-compatibility.sh @@ -25,10 +25,6 @@ psql -c "SELECT * FROM pg_available_extension_versions WHERE name LIKE 'cranksha # Install in the fresh DB psql $DBNAME <<'EOF' --- Install dependencies -CREATE EXTENSION plpythonu; -CREATE EXTENSION postgis; - -- Create role publicuser if it does not exist DO $$ @@ -44,7 +40,7 @@ END $$ LANGUAGE plpgsql; -- Install the default version -CREATE EXTENSION crankshaft; +CREATE EXTENSION crankshaft CASCADE; \dx EOF