c - How to change python version in makefile - compiling Multicorn (PostgreSQL FDW extension) -


i'm trying install postgresql extension multicorn on centos 6.5. problem have though default version of python on centos 2.6 , multicorn requires 2.7 or 3.3. i'm trying compile multicorn using this tutorial, it's little dated , step python version changed doesn't work anymore:

sed -i 's/^pyexec = python$/pyexec = python2.7/' makefile 

can me make above command work again, or show me how edit makefile change version of python? can call python version 2.7 in command line python2.7. version 2.6 called python - apparently can't change without breaking centos.

this makefile:

module_big   = multicorn objs         =  src/errors.o src/python.o src/query.o src/multicorn.o   data         = $(filter-out $(wildcard sql/*--*.sql),$(wildcard sql/*.sql))  docs         = $(wildcard doc/*.md)  extension    = multicorn extversion   = $(shell grep default_version $(extension).control | sed -e "s/default_version[[:space:]]*=[[:space:]]*'\([^']*\)'/\1/")  all: preflight-check sql/$(extension)--$(extversion).sql  install: python_code   sql/$(extension)--$(extversion).sql: sql/$(extension).sql     cp $< $@  preflight-check:     ./preflight-check.sh   python_code: setup.py     cp ./setup.py ./setup--$(extversion).py     sed -i -e "s/__version__/$(extversion)-dev/g" ./setup--$(extversion).py     $(python) ./setup--$(extversion).py install     rm ./setup--$(extversion).py  release-zip:     git archive --format zip --prefix=multicorn-$(extversion)/ --output ./multicorn-$(extversion).zip head     unzip ./multicorn-$(extversion).zip     rm ./multicorn-$(extversion).zip     sed -i -e "s/__version__/$(extversion)/g"  ./multicorn-$(extversion)/meta.json  ./multicorn-$(extversion)/setup.py  ./multicorn-$(extversion)/python/multicorn/__init__.py     zip -r ./multicorn-$(extversion).zip ./multicorn-$(extversion)/     rm ./multicorn-$(extversion) -rf  coverage:     lcov -d . -c -o lcov.info     genhtml --show-details --legend --output-directory=coverage --title=postgresql --num-spaces=4 --prefix=./src/ `find . -name lcov.info -print`  data = sql/$(extension)--$(extversion).sql extra_clean = sql/$(extension)--$(extversion).sql ./multicorn-$(extversion).zip pg_config ?= pg_config pgxs := $(shell $(pg_config) --pgxs) regress      = virtual_tests  include $(pgxs)  with_python_no_override = no  ifeq ($(with_python),yes)     with_python_no_override = yes endif  ifdef python_override     with_python_no_override = no endif   ifeq ($(with_python_no_override),yes)     shlib_link = $(python_libspec) $(python_additional_libs) $(filter -lintl,$(libs))     override cppflags := -i. -i$(srcdir) $(python_includespec) $(cppflags)     override python = python${python_version} else     ifdef python_override         override python = ${python_override}     endif      ifeq (${python}, )         override python = python     endif       python_version = $(shell ${python} --version 2>&1 | cut -d ' ' -f 2 | cut -d '.' -f 1-2)     python_config ?= python${python_version}-config      py_libspec = $(shell ${python_config} --libs)     py_includespec = $(shell ${python_config} --includes)     py_cflags = $(shell ${python_config} --cflags)     py_ldflags = $(shell ${python_config} --ldflags)     shlib_link = $(py_libspec) $(py_ldflags) $(py_additional_libs) $(filter -lintl,$(libs))     override pg_cppflags  := $(py_includespec) $(pg_cppflags)     override cppflags := $(pg_cppflags) $(cppflags) endif   python_test_version ?= $(python_version) pg_test_version ?= $(majorversion) supports_write=$(shell expr ${pg_test_version} \>= 9.3)  tests        = $(wildcard test-$(python_test_version)/sql/multicorn*.sql) ifeq (${supports_write}, 1)   tests += $(wildcard test-$(python_test_version)/sql/write*.sql) endif regress      = $(patsubst test-$(python_test_version)/sql/%.sql,%,$(tests)) regress_opts = --inputdir=test-$(python_test_version) --load-language=plpgsql  $(info python version $(python_version)) 

the best practice run make as

python=python2.7 make 

if take @ line 26 of makefile, you'll see compilation handled setup.py script invoked executable specified in $(python) variable can override setting environment. way (e.g. if want multiple builds) one:

export python=python2.7 make 

changing script behavior enviroment variables or command line arguments more reasonable , more simple patching script source itself.

more makefile variables: http://ftp.gnu.org/old-gnu/manuals/make-3.79.1/html_chapter/make_6.html#sec68


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -