Skip to content

Commit 3101dcc

Browse files
author
Dane Springmeyer
committed
start porting #144 to master
1 parent 752bd08 commit 3101dcc

4 files changed

Lines changed: 76 additions & 78 deletions

File tree

.travis.yml

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
language: generic
22

3-
git:
4-
submodules: true
5-
depth: 10
6-
7-
addons:
8-
postgresql: "9.4"
9-
103
matrix:
114
include:
125
- os: linux
136
sudo: false
14-
compiler: ": clang"
7+
compiler: clang
158
# note: only using ccache for CC is intentional here to
169
# workaround an odd bug in distutils that manifests when only `ccache` is used to link
1710
# because distutils also has a bug whereby CC is used to compile instead of CXX, this works :)
@@ -20,11 +13,10 @@ matrix:
2013
apt:
2114
sources: [ 'ubuntu-toolchain-r-test']
2215
packages: [ 'libstdc++-5-dev', 'gdb', 'apport']
23-
# disabled until I have time to fix https://github.com/mapnik/python-mapnik/issues/95
24-
#- os: osx
25-
# osx_image: xcode7.3 # upgrades clang from 6 -> 7
26-
# compiler: clang
27-
# env: JOBS=4
16+
- os: osx
17+
osx_image: xcode8.2
18+
compiler: clang
19+
env: JOBS=4
2820

2921
cache:
3022
directories:
@@ -56,22 +48,13 @@ before_install:
5648
- |
5749
if [[ $(uname -s) == 'Linux' ]]; then
5850
export LDSHARED=$(python -c "import os;from distutils import sysconfig;print sysconfig.get_config_var('LDSHARED').replace('cc ','clang++-3.9 ')");
59-
./.mason/mason install clang++ 3.9.1
60-
export PATH=$(./.mason/mason prefix clang++ 3.9.1)/bin:${PATH}
51+
mason install clang++ 3.9.1
52+
export PATH=$(mason prefix clang++ 3.9.1)/bin:${PATH}
6153
which clang++
6254
else
6355
sudo easy_install pip;
64-
brew info postgres;
65-
export DATA_PATH=$(brew --prefix)/var/postgres;
66-
rm -rf ${DATA_PATH};
67-
initdb ${DATA_PATH} -E utf8;
68-
pg_ctl -w start -l postgres.log --pgdata ${DATA_PATH};
69-
cat postgres.log;
70-
createuser -s postgres;
7156
export LDSHARED=$(python -c "import os;from distutils import sysconfig;print sysconfig.get_config_var('LDSHARED').replace('cc ','clang++ ')");
7257
fi
73-
- psql -c 'create database template_postgis;' -U postgres
74-
- psql -c 'create extension postgis;' -d template_postgis -U postgres
7558
- pip install --upgrade --user nose
7659
- pip install --upgrade --user wheel
7760
- pip install --upgrade --user twine
@@ -84,15 +67,15 @@ install:
8467
- python setup.py install --prefix ${PYTHONUSERBASE}
8568

8669
before_script:
87-
- ulimit -c unlimited -S
88-
- RESULT=0
89-
- python test/run_tests.py || RESULT=$?
90-
- ls -l .
91-
- for i in $(find ./ -maxdepth 1 -name 'core*' -print); do gdb $(which python) $i -ex "thread apply all bt" -ex "set pagination 0" -batch; done;
92-
- if [[ ${RESULT} != 0 ]]; then exit $RESULT; fi
70+
# start postgres/postgis
71+
- source mason-config.env
72+
- ./mason_packages/.link/bin/postgres -k ${PGHOST} > postgres.log &
9373

9474
script:
75+
- python test/run_tests.py
9576
- python test/visual.py -q
77+
# stop postgres
78+
- ./mason_packages/.link/bin/pg_ctl -w stop
9679
- |
9780
if [[ ${COMMIT_MESSAGE} =~ "[publish]" ]]; then
9881
python setup.py bdist_wheel

bootstrap.sh

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,42 +14,61 @@ function install() {
1414
ICU_VERSION="57.1"
1515

1616
function install_mason_deps() {
17-
install mapnik 333ef9f
18-
install jpeg_turbo 1.5.1 libjpeg
19-
install libpng 1.6.28 libpng
20-
install libtiff 4.0.7 libtiff
17+
install mapnik df0bbe4
18+
install jpeg_turbo 1.5.1
19+
install libpng 1.6.28
20+
install libtiff 4.0.7
2121
install libpq 9.6.2
22-
install sqlite 3.17.0 libsqlite3
23-
install expat 2.2.0 libexpat
22+
install sqlite 3.17.0
23+
install expat 2.2.0
2424
install icu ${ICU_VERSION}
25-
install proj 4.9.3 libproj
26-
install pixman 0.34.0 libpixman-1
27-
install cairo 1.14.8 libcairo
28-
install webp 0.6.0 libwebp
29-
install libgdal 2.1.3 libgdal
25+
install proj 4.9.3
26+
install pixman 0.34.0
27+
install cairo 1.14.8
28+
install webp 0.6.0
29+
install libgdal 2.1.3
3030
install boost 1.63.0
3131
install boost_libsystem 1.63.0
3232
install boost_libfilesystem 1.63.0
3333
install boost_libprogram_options 1.63.0
3434
install boost_libregex_icu57 1.63.0
35-
install freetype 2.7.1 libfreetype
36-
install harfbuzz 1.4.2-ft libharfbuzz
35+
install freetype 2.7.1
36+
install harfbuzz 1.4.2-ft
3737
# deps needed by python-mapnik (not mapnik core)
3838
install boost_libthread 1.63.0
3939
install boost_libpython 1.63.0
40+
install postgis 2.3.2-1
4041
}
4142

4243
function setup_runtime_settings() {
4344
local MASON_LINKED_ABS=$(pwd)/mason_packages/.link
44-
export PROJ_LIB=${MASON_LINKED_ABS}/share/proj
45-
export ICU_DATA=${MASON_LINKED_ABS}/share/icu/${ICU_VERSION}
46-
export GDAL_DATA=${MASON_LINKED_ABS}/share/gdal
47-
if [[ $(uname -s) == 'Darwin' ]]; then
48-
export DYLD_LIBRARY_PATH=$(pwd)/mason_packages/.link/lib:${DYLD_LIBRARY_PATH}
49-
else
50-
export LD_LIBRARY_PATH=$(pwd)/mason_packages/.link/lib:${LD_LIBRARY_PATH}
51-
fi
52-
export PATH=$(pwd)/mason_packages/.link/bin:${PATH}
45+
echo "export PROJ_LIB=${MASON_LINKED_ABS}/share/proj" > mason-config.env
46+
echo "export ICU_DATA=${MASON_LINKED_ABS}/share/icu/${ICU_VERSION}" >> mason-config.env
47+
echo "export GDAL_DATA=${MASON_LINKED_ABS}/share/gdal" >> mason-config.env
48+
echo "export PATH=$(pwd)/mason_packages/.link/bin:${PATH}" >> mason-config.env
49+
echo "export PGTEMP_DIR=$(pwd)/local-tmp" >> mason-config.env
50+
echo "export PGDATA=$(pwd)/local-postgres" >> mason-config.env
51+
echo "export PGHOST=$(pwd)/local-unix-socket" >> mason-config.env
52+
echo "export PGPORT=1111" >> mason-config.env
53+
54+
source mason-config.env
55+
rm -rf ${PGHOST}
56+
mkdir -p ${PGHOST}
57+
rm -rf ${PGDATA}
58+
mkdir -p ${PGDATA}
59+
rm -rf ${PGTEMP_DIR}
60+
mkdir -p ${PGTEMP_DIR}
61+
./mason_packages/.link/bin/initdb
62+
sleep 2
63+
./mason_packages/.link/bin/postgres -k ${PGHOST} > postgres.log &
64+
sleep 2
65+
./mason_packages/.link/bin/createdb template_postgis -T postgres
66+
./mason_packages/.link/bin/psql template_postgis -c "CREATE TABLESPACE temp_disk LOCATION '${PGTEMP_DIR}';"
67+
./mason_packages/.link/bin/psql template_postgis -c "SET temp_tablespaces TO 'temp_disk';"
68+
./mason_packages/.link/bin/psql template_postgis -c "CREATE PROCEDURAL LANGUAGE 'plpythonu' HANDLER plpython_call_handler;"
69+
./mason_packages/.link/bin/psql template_postgis -c "CREATE EXTENSION postgis;"
70+
./mason_packages/.link/bin/psql template_postgis -c "SELECT PostGIS_Full_Version();"
71+
./mason_packages/.link/bin/pg_ctl -w stop
5372
}
5473

5574
function main() {
@@ -59,10 +78,10 @@ function main() {
5978
setup_runtime_settings
6079
echo "Ready, now run:"
6180
echo ""
62-
echo " python setup.py test"
81+
echo " make test"
6382
}
6483

6584
main
6685

6786
set +eu
68-
set +o pipefail
87+
set +o pipefail

scripts/setup_mason.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -eu
44
set -o pipefail
55

66
# we pin the mason version to avoid changes in mason breaking builds
7-
MASON_VERSION="68a9498"
7+
MASON_VERSION="3870d9c"
88

99
function setup_mason() {
1010
if [[ ! -d ./.mason ]]; then

setup.py

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,10 @@ def run(self):
120120
'-lmapnik-json',
121121
] + ['-l%s' % i for i in get_boost_library_names()])
122122

123-
# Dynamically make the mapnik/paths.py file if it doesn't exist.
124-
if os.path.isfile('mapnik/paths.py'):
125-
create_paths = False
126-
else:
127-
create_paths = True
128-
f_paths = open('mapnik/paths.py', 'w')
129-
f_paths.write('import os\n')
130-
f_paths.write('\n')
123+
# Dynamically make the mapnik/paths.py file
124+
f_paths = open('mapnik/paths.py', 'w')
125+
f_paths.write('import os\n')
126+
f_paths.write('\n')
131127

132128
input_plugin_path = check_output([mapnik_config, '--input-plugins'])
133129
font_path = check_output([mapnik_config, '--fonts'])
@@ -147,30 +143,32 @@ def run(self):
147143
input_plugin_files = os.listdir(input_plugin_path)
148144
input_plugin_files = [os.path.join(
149145
input_plugin_path, f) for f in input_plugin_files]
150-
if not os.path.exists(os.path.join('mapnik', 'plugins', 'input')):
151-
os.makedirs(os.path.join('mapnik', 'plugins', 'input'))
146+
if not os.path.exists(os.path.join('mapnik', 'lib', 'mapnik', 'input')):
147+
os.makedirs(os.path.join('mapnik', 'lib', 'mapnik', 'input'))
152148
for f in input_plugin_files:
153149
try:
154150
shutil.copyfile(f, os.path.join(
155-
'mapnik', 'plugins', 'input', os.path.basename(f)))
151+
'mapnik', 'lib', 'mapnik', 'input', os.path.basename(f)))
156152
except shutil.Error:
157153
pass
158154
font_files = os.listdir(font_path)
159155
font_files = [os.path.join(font_path, f) for f in font_files]
160-
if not os.path.exists(os.path.join('mapnik', 'plugins', 'fonts')):
161-
os.makedirs(os.path.join('mapnik', 'plugins', 'fonts'))
156+
if not os.path.exists(os.path.join('mapnik', 'lib', 'mapnik', 'fonts')):
157+
os.makedirs(os.path.join('mapnik', 'lib', 'mapnik', 'fonts'))
162158
for f in font_files:
163159
try:
164160
shutil.copyfile(f, os.path.join(
165-
'mapnik', 'plugins', 'fonts', os.path.basename(f)))
161+
'mapnik', 'lib', 'mapnik', 'fonts', os.path.basename(f)))
166162
except shutil.Error:
167163
pass
168-
if create_paths:
169-
f_paths.write(
170-
'mapniklibpath = os.path.join(os.path.dirname(os.path.realpath(__file__)), "plugins")\n')
171-
f_paths.write("inputpluginspath = os.path.join(mapniklibpath,'input')\n")
172-
f_paths.write("fontscollectionpath = os.path.join(mapniklibpath,'fonts')\n")
173-
elif create_paths:
164+
f_paths.write(
165+
'mapniklibpath = os.path.join(os.path.dirname(os.path.realpath(__file__)), "lib")\n')
166+
f_paths.write("inputpluginspath = os.path.join(mapniklibpath, 'mapnik', 'input')\n")
167+
f_paths.write("fontscollectionpath = os.path.join(mapniklibpath, 'mapnik', 'fonts')\n")
168+
f_paths.write(
169+
"__all__ = [mapniklibpath,inputpluginspath,fontscollectionpath]\n")
170+
f_paths.close()
171+
else:
174172
if os.environ.get('LIB_DIR_NAME'):
175173
mapnik_lib_path = lib_path + os.environ.get('LIB_DIR_NAME')
176174
else:
@@ -181,8 +179,6 @@ def run(self):
181179
"inputpluginspath = '{path}'\n".format(path=input_plugin_path))
182180
f_paths.write(
183181
"fontscollectionpath = '{path}'\n".format(path=font_path))
184-
185-
if create_paths:
186182
f_paths.write(
187183
"__all__ = [mapniklibpath,inputpluginspath,fontscollectionpath]\n")
188184
f_paths.close()
@@ -269,7 +265,7 @@ def run(self):
269265
'nose',
270266
],
271267
package_data={
272-
'mapnik': ['lib/*', 'plugins/*/*', 'share/*/*'],
268+
'mapnik': ['lib/*.*', 'lib/*/*/*', 'share/*/*'],
273269
},
274270
test_suite='nose.collector',
275271
cmdclass={

0 commit comments

Comments
 (0)