[Python-modules-commits] [basemap] 12/19: merge patched into master
Sandro Tosi
morph at moszumanska.debian.org
Wed Jan 24 03:51:38 UTC 2018
This is an automated email from the git hooks/post-receive script.
morph pushed a commit to branch master
in repository basemap.
commit 4b00acaa9440186c41b22151315adee68fba1f81
Merge: 115b9d4 d05917b
Author: Sandro Tosi <morph at debian.org>
Date: Sun Jan 21 21:03:26 2018 -0500
merge patched into master
.cvsignore | 2 +
.gitignore | 69 +
.requirements-2.6.txt | 1 +
.travis.yml | 148 +
Changelog | 94 +-
LICENSE_proj4 | 34 -
LICENSE_pyshp | 3 -
PKG-INFO | 27 +-
README => README.md | 114 +-
debian/.git-dpm | 6 +-
debian/patches/add_shebang_data_scripts | 53 -
debian/patches/dont_install_data_files | 16 +-
debian/patches/fix_ftbfs_with_geos3.3 | 31 -
debian/patches/install_matplotlib_sphinxext | 2 +-
debian/patches/series | 2 -
debian/patches/use_share_datafiles | 36 +-
doc/conf.py | 2 +-
doc/index.rst | 4 +-
doc/matplotlibrc | 1 +
doc/users/figures/background2.py | 1 -
doc/users/figures/geos_partial.py | 2 +-
doc/users/figures/lcc.py | 2 +-
doc/users/figures/nsper_partial.py | 2 +-
doc/users/figures/ortho_partial.py | 2 +-
doc/users/geography.rst | 4 +-
doc/users/installing.rst | 13 +-
doc/users/intro.rst | 30 +-
examples/allskymap.py | 5 +-
examples/camx.sample.nc | Bin 0 -> 35558 bytes
examples/land_shallow_topo_2048.jpg | Bin 0 -> 238676 bytes
examples/nsper_demo.py | 49 +
examples/nytolondon.py | 56 +
examples/panelplot.py | 85 +
examples/plotmap_masked.py | 2 +-
examples/plotozone.py | 106 +
examples/run_all.py | 11 +
examples/streamplot_demo.py | 2 +-
examples/testwmsimage.py | 5 +-
examples/utmtest.py | 2 +-
lib/mpl_toolkits/basemap/__init__.py | 829 +-
lib/mpl_toolkits/basemap/data/GL27 | 22 -
lib/mpl_toolkits/basemap/data/IGNF | 487 -
lib/mpl_toolkits/basemap/data/README | 72 -
lib/mpl_toolkits/basemap/data/countries_c.dat | Bin 18672 -> 168360 bytes
lib/mpl_toolkits/basemap/data/countries_f.dat | Bin 3122600 -> 3115216 bytes
lib/mpl_toolkits/basemap/data/countries_h.dat | Bin 580112 -> 832216 bytes
lib/mpl_toolkits/basemap/data/countries_i.dat | Bin 209840 -> 348088 bytes
lib/mpl_toolkits/basemap/data/countries_l.dat | Bin 61440 -> 248400 bytes
lib/mpl_toolkits/basemap/data/countriesmeta_c.dat | 1009 +-
lib/mpl_toolkits/basemap/data/countriesmeta_f.dat | 4701 +-
lib/mpl_toolkits/basemap/data/countriesmeta_h.dat | 2437 +-
lib/mpl_toolkits/basemap/data/countriesmeta_i.dat | 1465 +-
lib/mpl_toolkits/basemap/data/countriesmeta_l.dat | 1169 +-
lib/mpl_toolkits/basemap/data/epsg | 8628 -
lib/mpl_toolkits/basemap/data/esri | 5937 -
lib/mpl_toolkits/basemap/data/esri.extra | 948 -
lib/mpl_toolkits/basemap/data/gshhs_c.dat | Bin 102640 -> 100808 bytes
lib/mpl_toolkits/basemap/data/gshhs_f.dat | Bin 82801672 -> 84707544 bytes
lib/mpl_toolkits/basemap/data/gshhs_h.dat | Bin 15257928 -> 15391144 bytes
lib/mpl_toolkits/basemap/data/gshhs_i.dat | Bin 3603320 -> 3606784 bytes
lib/mpl_toolkits/basemap/data/gshhs_l.dat | Bin 720264 -> 719016 bytes
lib/mpl_toolkits/basemap/data/gshhsmeta_c.dat | 3588 +-
lib/mpl_toolkits/basemap/data/gshhsmeta_f.dat | 376837 +++++++++---------
lib/mpl_toolkits/basemap/data/gshhsmeta_h.dat | 306639 +++++++-------
lib/mpl_toolkits/basemap/data/gshhsmeta_i.dat | 82374 ++--
lib/mpl_toolkits/basemap/data/gshhsmeta_l.dat | 21319 +-
lib/mpl_toolkits/basemap/data/lsmask_1.25min_c.bin | Bin 347367 -> 347295 bytes
lib/mpl_toolkits/basemap/data/lsmask_1.25min_f.bin | Bin 684215 -> 684487 bytes
lib/mpl_toolkits/basemap/data/lsmask_1.25min_i.bin | Bin 581414 -> 582277 bytes
lib/mpl_toolkits/basemap/data/lsmask_1.25min_l.bin | Bin 457862 -> 458273 bytes
lib/mpl_toolkits/basemap/data/lsmask_10min_c.bin | Bin 20797 -> 20781 bytes
lib/mpl_toolkits/basemap/data/lsmask_10min_f.bin | Bin 31826 -> 31804 bytes
lib/mpl_toolkits/basemap/data/lsmask_10min_i.bin | Bin 30054 -> 30042 bytes
lib/mpl_toolkits/basemap/data/lsmask_10min_l.bin | Bin 25888 -> 25901 bytes
lib/mpl_toolkits/basemap/data/lsmask_2.5min_c.bin | Bin 129232 -> 129142 bytes
lib/mpl_toolkits/basemap/data/lsmask_2.5min_f.bin | Bin 248194 -> 248126 bytes
lib/mpl_toolkits/basemap/data/lsmask_2.5min_i.bin | Bin 218044 -> 218313 bytes
lib/mpl_toolkits/basemap/data/lsmask_2.5min_l.bin | Bin 174232 -> 174340 bytes
lib/mpl_toolkits/basemap/data/lsmask_5min_c.bin | Bin 50301 -> 50263 bytes
lib/mpl_toolkits/basemap/data/lsmask_5min_f.bin | Bin 87592 -> 87517 bytes
lib/mpl_toolkits/basemap/data/lsmask_5min_i.bin | Bin 79837 -> 79853 bytes
lib/mpl_toolkits/basemap/data/lsmask_5min_l.bin | Bin 66238 -> 66305 bytes
lib/mpl_toolkits/basemap/data/nad.lst | 142 -
lib/mpl_toolkits/basemap/data/nad27 | 809 -
lib/mpl_toolkits/basemap/data/nad83 | 744 -
lib/mpl_toolkits/basemap/data/ntf_r93.gsb | Bin 277424 -> 0 bytes
lib/mpl_toolkits/basemap/data/ntv1_can.dat | Bin 1113184 -> 0 bytes
lib/mpl_toolkits/basemap/data/ntv2_out.dist | 11 -
lib/mpl_toolkits/basemap/data/nzgd2kgrid0005.gsb | Bin 318464 -> 0 bytes
lib/mpl_toolkits/basemap/data/other.extra | 53 -
lib/mpl_toolkits/basemap/data/pj_out27.dist | 265 -
lib/mpl_toolkits/basemap/data/pj_out83.dist | 225 -
lib/mpl_toolkits/basemap/data/proj_def.dat | 17 -
lib/mpl_toolkits/basemap/data/proj_outIGNF.dist | 40 -
lib/mpl_toolkits/basemap/data/rivers_c.dat | Bin 382640 -> 381872 bytes
lib/mpl_toolkits/basemap/data/rivers_f.dat | Bin 18276680 -> 18261392 bytes
lib/mpl_toolkits/basemap/data/rivers_h.dat | Bin 4309272 -> 4300464 bytes
lib/mpl_toolkits/basemap/data/rivers_i.dat | Bin 1593216 -> 1590176 bytes
lib/mpl_toolkits/basemap/data/rivers_l.dat | Bin 573288 -> 571880 bytes
lib/mpl_toolkits/basemap/data/riversmeta_c.dat | 46558 ++-
lib/mpl_toolkits/basemap/data/riversmeta_f.dat | 47813 ++-
lib/mpl_toolkits/basemap/data/riversmeta_h.dat | 47067 ++-
lib/mpl_toolkits/basemap/data/riversmeta_i.dat | 46704 ++-
lib/mpl_toolkits/basemap/data/riversmeta_l.dat | 46600 ++-
lib/mpl_toolkits/basemap/data/states_c.dat | Bin 19488 -> 177008 bytes
lib/mpl_toolkits/basemap/data/states_f.dat | Bin 2820752 -> 2824000 bytes
lib/mpl_toolkits/basemap/data/states_h.dat | Bin 465624 -> 854832 bytes
lib/mpl_toolkits/basemap/data/states_i.dat | Bin 172928 -> 379888 bytes
lib/mpl_toolkits/basemap/data/states_l.dat | Bin 56224 -> 264944 bytes
lib/mpl_toolkits/basemap/data/statesmeta_c.dat | 1389 +-
lib/mpl_toolkits/basemap/data/statesmeta_f.dat | 8283 +-
lib/mpl_toolkits/basemap/data/statesmeta_h.dat | 2803 +-
lib/mpl_toolkits/basemap/data/statesmeta_i.dat | 1864 +-
lib/mpl_toolkits/basemap/data/statesmeta_l.dat | 1548 +-
lib/mpl_toolkits/basemap/data/td_out.dist | 25 -
lib/mpl_toolkits/basemap/data/test27 | 847 -
lib/mpl_toolkits/basemap/data/test83 | 728 -
lib/mpl_toolkits/basemap/data/testIGNF | 166 -
lib/mpl_toolkits/basemap/data/testdatumfile | 113 -
lib/mpl_toolkits/basemap/data/testntv2 | 73 -
lib/mpl_toolkits/basemap/data/testvarious | 435 -
lib/mpl_toolkits/basemap/data/tv_out.dist | 188 -
lib/mpl_toolkits/basemap/data/world | 212 -
lib/mpl_toolkits/basemap/diagnostic.py | 118 +
lib/mpl_toolkits/basemap/proj.py | 2 +-
lib/mpl_toolkits/basemap/pyproj.py | 867 -
lib/mpl_toolkits/basemap/shapefile.py | 1128 -
lib/mpl_toolkits/basemap/test.py | 186 +-
requirements.txt | 2 +
setup.py | 116 +-
src/PJ_aea.c | 162 -
src/PJ_aeqd.c | 271 -
src/PJ_airy.c | 124 -
src/PJ_aitoff.c | 76 -
src/PJ_august.c | 18 -
src/PJ_bacon.c | 41 -
src/PJ_bipc.c | 132 -
src/PJ_boggs.c | 32 -
src/PJ_bonne.c | 85 -
src/PJ_cass.c | 79 -
src/PJ_cc.c | 19 -
src/PJ_cea.c | 60 -
src/PJ_chamb.c | 112 -
src/PJ_collg.c | 29 -
src/PJ_crast.c | 22 -
src/PJ_denoy.c | 18 -
src/PJ_eck1.c | 19 -
src/PJ_eck2.c | 28 -
src/PJ_eck3.c | 50 -
src/PJ_eck4.c | 44 -
src/PJ_eck5.c | 18 -
src/PJ_eqc.c | 23 -
src/PJ_eqdc.c | 85 -
src/PJ_fahey.c | 17 -
src/PJ_fouc_s.c | 45 -
src/PJ_gall.c | 19 -
src/PJ_geos.c | 192 -
src/PJ_gins8.c | 17 -
src/PJ_gn_sinu.c | 98 -
src/PJ_gnom.c | 105 -
src/PJ_goode.c | 49 -
src/PJ_gstmerc.c | 48 -
src/PJ_hammer.c | 43 -
src/PJ_hatano.c | 50 -
src/PJ_healpix.c | 703 -
src/PJ_igh.c | 190 -
src/PJ_imw_p.c | 151 -
src/PJ_isea.c | 1134 -
src/PJ_krovak.c | 250 -
src/PJ_labrd.c | 109 -
src/PJ_laea.c | 233 -
src/PJ_lagrng.c | 35 -
src/PJ_larr.c | 12 -
src/PJ_lask.c | 26 -
src/PJ_lcc.c | 105 -
src/PJ_lcca.c | 72 -
src/PJ_loxim.c | 41 -
src/PJ_lsat.c | 171 -
src/PJ_mbt_fps.c | 38 -
src/PJ_mbtfpp.c | 32 -
src/PJ_mbtfpq.c | 47 -
src/PJ_merc.c | 47 -
src/PJ_mill.c | 15 -
src/PJ_mod_ster.c | 211 -
src/PJ_moll.c | 60 -
src/PJ_natearth.c | 77 -
src/PJ_nell.c | 29 -
src/PJ_nell_h.c | 30 -
src/PJ_nocol.c | 38 -
src/PJ_nsper.c | 149 -
src/PJ_nzmg.c | 107 -
src/PJ_ob_tran.c | 144 -
src/PJ_ocea.c | 68 -
src/PJ_oea.c | 58 -
src/PJ_omerc.c | 194 -
src/PJ_ortho.c | 95 -
src/PJ_poly.c | 99 -
src/PJ_putp2.c | 40 -
src/PJ_putp3.c | 26 -
src/PJ_putp4p.c | 29 -
src/PJ_putp5.c | 26 -
src/PJ_putp6.c | 59 -
src/PJ_robin.c | 105 -
src/PJ_rpoly.c | 35 -
src/PJ_sconics.c | 154 -
src/PJ_somerc.c | 66 -
src/PJ_stere.c | 241 -
src/PJ_sterea.c | 85 -
src/PJ_sts.c | 54 -
src/PJ_tcc.c | 17 -
src/PJ_tcea.c | 27 -
src/PJ_tmerc.c | 175 -
src/PJ_tpeqd.c | 76 -
src/PJ_urm5.c | 28 -
src/PJ_urmfps.c | 40 -
src/PJ_vandg.c | 78 -
src/PJ_vandg2.c | 45 -
src/PJ_vandg4.c | 41 -
src/PJ_wag2.c | 21 -
src/PJ_wag3.c | 24 -
src/PJ_wag7.c | 14 -
src/PJ_wink1.c | 20 -
src/PJ_wink2.c | 34 -
src/_geoslib.c | 5354 +-
src/_geoslib.pyx | 24 +-
src/_proj.c | 7801 -
src/_proj.pyx | 524 -
src/aasincos.c | 35 -
src/adjlon.c | 15 -
src/bch2bps.c | 140 -
src/bchgen.c | 58 -
src/biveval.c | 87 -
src/dmstor.c | 113 -
src/emess.c | 57 -
src/emess.h | 28 -
src/gen_cheb.c | 71 -
src/geocent.c | 435 -
src/geocent.h | 179 -
src/geod_interface.c | 34 -
src/geod_interface.h | 45 -
src/geod_set.c | 66 -
src/geodesic.c | 1519 -
src/geodesic.h | 533 -
src/hypot.c | 36 -
src/mk_cheby.c | 161 -
src/nad_cvt.c | 68 -
src/nad_init.c | 311 -
src/nad_intr.c | 62 -
src/nad_list.h | 6 -
src/org_proj4_Projections.h | 37 -
src/p_series.c | 39 -
src/pj_apply_gridshift.c | 253 -
src/pj_apply_vgridshift.c | 208 -
src/pj_auth.c | 30 -
src/pj_ctx.c | 179 -
src/pj_datum_set.c | 154 -
src/pj_datums.c | 90 -
src/pj_deriv.c | 33 -
src/pj_ell_set.c | 105 -
src/pj_ellps.c | 56 -
src/pj_errno.c | 17 -
src/pj_factors.c | 86 -
src/pj_fwd.c | 37 -
src/pj_gauss.c | 94 -
src/pj_gc_reader.c | 221 -
src/pj_geocent.c | 57 -
src/pj_gridcatalog.c | 282 -
src/pj_gridinfo.c | 870 -
src/pj_gridlist.c | 224 -
src/pj_init.c | 518 -
src/pj_initcache.c | 181 -
src/pj_inv.c | 33 -
src/pj_latlong.c | 80 -
src/pj_list.c | 11 -
src/pj_list.h | 142 -
src/pj_log.c | 73 -
src/pj_malloc.c | 27 -
src/pj_mlfn.c | 57 -
src/pj_msfn.c | 7 -
src/pj_mutex.c | 196 -
src/pj_open_lib.c | 176 -
src/pj_param.c | 108 -
src/pj_phi2.c | 25 -
src/pj_pr_list.c | 91 -
src/pj_qsfn.c | 16 -
src/pj_release.c | 11 -
src/pj_strerrno.c | 85 -
src/pj_transform.c | 826 -
src/pj_tsfn.c | 10 -
src/pj_units.c | 37 -
src/pj_utils.c | 173 -
src/pj_zpoly1.c | 46 -
src/proj.def | 41 -
src/proj_api.h | 134 -
src/proj_etmerc.c | 252 -
src/proj_mdist.c | 123 -
src/proj_rouss.c | 122 -
src/projects.h | 532 -
src/rtodms.c | 72 -
src/vector1.c | 29 -
utils/README | 44 +
utils/dumpbounds.sh | 28 +
utils/readboundaries.py | 182 +
utils/readboundaries_shp.py | 230 +
utils/update_landmasks.py | 65 +
305 files changed, 521705 insertions(+), 590098 deletions(-)
diff --cc debian/.git-dpm
index 6aa0899,0000000..996a9d5
mode 100644,000000..100644
--- a/debian/.git-dpm
+++ b/debian/.git-dpm
@@@ -1,11 -1,0 +1,11 @@@
+# see git-dpm(1) from git-dpm package
- 4e11491771c9c5c8c156f0f65be728eedaf0ebac
- 4e11491771c9c5c8c156f0f65be728eedaf0ebac
- d6a103d5949b81f9755e71d1705dd7023dfa0861
++d05917bf1b4cbe12a21300d90c28c38760cb2d17
++d05917bf1b4cbe12a21300d90c28c38760cb2d17
++3778c573a31f9c4c4370ed925034523f6bc6e485
+3778c573a31f9c4c4370ed925034523f6bc6e485
+basemap_1.1.0+dfsg.orig.tar.gz
+f7131c4cf31eec4f4d670207c1ff2e01a4f109a9
+129792317
+debianTag="debian/%e%v"
+patchedTag="patched/%e%v"
+upstreamTag="upstream/%e%u"
diff --cc debian/patches/dont_install_data_files
index cec2953,0000000..a6123f4
mode 100644,000000..100644
--- a/debian/patches/dont_install_data_files
+++ b/debian/patches/dont_install_data_files
@@@ -1,24 -1,0 +1,22 @@@
- From 7dbcc88c93e3602a08af8ccc72f630cb061752f7 Mon Sep 17 00:00:00 2001
++From adf1fe70130b8032086cd52f63576cf0c01dbafd Mon Sep 17 00:00:00 2001
+From: Sandro Tosi <morph at debian.org>
+Date: Thu, 8 Oct 2015 08:29:07 -0700
+Subject: Don't install the datafile with distutils, we'll use dh and a
+
+ separate arch:all package
+Forwarded: no
+Patch-Name: dont_install_data_files
+---
- setup.py | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
++ setup.py | 1 -
++ 1 file changed, 1 deletion(-)
+
+diff --git a/setup.py b/setup.py
- index a8497f0..9123897 100644
++index 3b23b58..6b2012b 100644
+--- a/setup.py
++++ b/setup.py
- @@ -137,6 +137,5 @@ setup(
- namespace_packages = namespace_packages,
++@@ -148,5 +148,4 @@ setup(
+ package_dir = package_dirs,
- ext_modules = extensions,
- - cmdclass = {'build_py': build_py},
++ ext_modules = extensions,
++ cmdclass = {'build_py': build_py},
+- package_data = package_data
- + cmdclass = {'build_py': build_py}
+ )
diff --cc debian/patches/install_matplotlib_sphinxext
index 8976319,0000000..9a86a59
mode 100644,000000..100644
--- a/debian/patches/install_matplotlib_sphinxext
+++ b/debian/patches/install_matplotlib_sphinxext
@@@ -1,1451 -1,0 +1,1451 @@@
- From ca5cada6a3f6d21a6b1b2eea928fc23dca84f71b Mon Sep 17 00:00:00 2001
++From d05917bf1b4cbe12a21300d90c28c38760cb2d17 Mon Sep 17 00:00:00 2001
+From: Sandro Tosi <morph at debian.org>
+Date: Thu, 8 Oct 2015 08:29:11 -0700
+Subject: add the matplotlib sphinxext directory into doc, needed to build
+
+ documentaion
+Forwarded: not-needed
+Patch-Name: install_matplotlib_sphinxext
+---
+ doc/sphinxext/gen_gallery.py | 124 ++++++++
+ doc/sphinxext/gen_rst.py | 158 ++++++++++
+ doc/sphinxext/inheritance_diagram.py | 407 ++++++++++++++++++++++++++
+ doc/sphinxext/math_symbol_table.py | 159 ++++++++++
+ doc/sphinxext/mathml.py | 552 +++++++++++++++++++++++++++++++++++
+ 5 files changed, 1400 insertions(+)
+ create mode 100644 doc/sphinxext/gen_gallery.py
+ create mode 100644 doc/sphinxext/gen_rst.py
+ create mode 100644 doc/sphinxext/inheritance_diagram.py
+ create mode 100644 doc/sphinxext/math_symbol_table.py
+ create mode 100644 doc/sphinxext/mathml.py
+
+diff --git a/doc/sphinxext/gen_gallery.py b/doc/sphinxext/gen_gallery.py
+new file mode 100644
+index 0000000..d47df8a
+--- /dev/null
++++ b/doc/sphinxext/gen_gallery.py
+@@ -0,0 +1,124 @@
++# generate a thumbnail gallery of examples
++template = """\
++{%% extends "layout.html" %%}
++{%% set title = "Thumbnail gallery" %%}
++
++
++{%% block body %%}
++
++<h3>Click on any image to see full size image and source code</h3>
++<br/>
++
++%s
++{%% endblock %%}
++"""
++
++import os, glob, re, sys, warnings
++import matplotlib.image as image
++
++multiimage = re.compile('(.*)_\d\d')
++
++def make_thumbnail(args):
++ image.thumbnail(args[0], args[1], 0.3)
++
++def out_of_date(original, derived):
++ return (not os.path.exists(derived) or
++ os.stat(derived).st_mtime < os.stat(original).st_mtime)
++
++def gen_gallery(app, doctree):
++ if app.builder.name != 'html':
++ return
++
++ outdir = app.builder.outdir
++ rootdir = 'plot_directive/mpl_examples'
++
++ # images we want to skip for the gallery because they are an unusual
++ # size that doesn't layout well in a table, or because they may be
++ # redundant with other images or uninteresting
++ skips = set([
++ 'mathtext_examples',
++ 'matshow_02',
++ 'matshow_03',
++ 'matplotlib_icon',
++ ])
++
++ data = []
++ thumbnails = {}
++
++ for subdir in ('api', 'pylab_examples', 'mplot3d', 'widgets', 'axes_grid' ):
++ origdir = os.path.join('build', rootdir, subdir)
++ thumbdir = os.path.join(outdir, rootdir, subdir, 'thumbnails')
++ if not os.path.exists(thumbdir):
++ os.makedirs(thumbdir)
++
++ for filename in sorted(glob.glob(os.path.join(origdir, '*.png'))):
++ if filename.endswith("hires.png"):
++ continue
++
++ path, filename = os.path.split(filename)
++ basename, ext = os.path.splitext(filename)
++ if basename in skips:
++ continue
++
++ # Create thumbnails based on images in tmpdir, and place
++ # them within the build tree
++ orig_path = str(os.path.join(origdir, filename))
++ thumb_path = str(os.path.join(thumbdir, filename))
++ if out_of_date(orig_path, thumb_path) or True:
++ thumbnails[orig_path] = thumb_path
++
++ m = multiimage.match(basename)
++ if m is None:
++ pyfile = '%s.py'%basename
++ else:
++ basename = m.group(1)
++ pyfile = '%s.py'%basename
++
++ data.append((subdir, basename,
++ os.path.join(rootdir, subdir, 'thumbnails', filename)))
++
++ link_template = """\
++ <a href="%s"><img src="%s" border="0" alt="%s"/></a>
++ """
++
++ if len(data) == 0:
++ warnings.warn("No thumbnails were found")
++
++ rows = []
++ for (subdir, basename, thumbfile) in data:
++ if thumbfile is not None:
++ link = 'examples/%s/%s.html'%(subdir, basename)
++ rows.append(link_template%(link, thumbfile, basename))
++
++ # Only write out the file if the contents have actually changed.
++ # Otherwise, this triggers a full rebuild of the docs
++ content = template%'\n'.join(rows)
++ gallery_path = os.path.join(app.builder.srcdir, '_templates', 'gallery.html')
++ if os.path.exists(gallery_path):
++ fh = file(gallery_path, 'r')
++ regenerate = fh.read() != content
++ fh.close()
++ else:
++ regenerate = True
++ if regenerate:
++ fh = file(gallery_path, 'w')
++ fh.write(content)
++ fh.close()
++
++ try:
++ import multiprocessing
++ app.builder.info("generating thumbnails... ", nonl=True)
++ pool = multiprocessing.Pool()
++ pool.map(make_thumbnail, thumbnails.iteritems())
++ pool.close()
++ pool.join()
++ app.builder.info("done")
++
++ except ImportError:
++ for key in app.builder.status_iterator(
++ thumbnails.iterkeys(), "generating thumbnails... ",
++ length=len(thumbnails)):
++ image.thumbnail(key, thumbnails[key], 0.3)
++
++def setup(app):
++ app.connect('env-updated', gen_gallery)
+diff --git a/doc/sphinxext/gen_rst.py b/doc/sphinxext/gen_rst.py
+new file mode 100644
+index 0000000..94418ac
+--- /dev/null
++++ b/doc/sphinxext/gen_rst.py
+@@ -0,0 +1,158 @@
++"""
++generate the rst files for the examples by iterating over the pylab examples
++"""
++import os, glob
++
++import os
++import re
++import sys
++fileList = []
++
++def out_of_date(original, derived):
++ """
++ Returns True if derivative is out-of-date wrt original,
++ both of which are full file paths.
++
++ TODO: this check isn't adequate in some cases. Eg, if we discover
++ a bug when building the examples, the original and derived will be
++ unchanged but we still want to force a rebuild.
++ """
++ return (not os.path.exists(derived) or
++ os.stat(derived).st_mtime < os.stat(original).st_mtime)
++
++noplot_regex = re.compile(r"#\s*-\*-\s*noplot\s*-\*-")
++
++def generate_example_rst(app):
++ rootdir = os.path.join(app.builder.srcdir, 'mpl_examples')
++ exampledir = os.path.join(app.builder.srcdir, 'examples')
++ if not os.path.exists(exampledir):
++ os.makedirs(exampledir)
++
++ datad = {}
++ for root, subFolders, files in os.walk(rootdir):
++ for fname in files:
++ if ( fname.startswith('.') or fname.startswith('#') or fname.startswith('_') or
++ fname.find('.svn')>=0 or not fname.endswith('.py') ):
++ continue
++
++ fullpath = os.path.join(root,fname)
++ contents = file(fullpath).read()
++ # indent
++ relpath = os.path.split(root)[-1]
++ datad.setdefault(relpath, []).append((fullpath, fname, contents))
++
++ subdirs = datad.keys()
++ subdirs.sort()
++
++ fhindex = file(os.path.join(exampledir, 'index.rst'), 'w')
++ fhindex.write("""\
++.. _examples-index:
++
++####################
++Matplotlib Examples
++####################
++
++.. htmlonly::
++
++ :Release: |version|
++ :Date: |today|
++
++.. toctree::
++ :maxdepth: 2
++
++""")
++
++ for subdir in subdirs:
++ rstdir = os.path.join(exampledir, subdir)
++ if not os.path.exists(rstdir):
++ os.makedirs(rstdir)
++
++ outputdir = os.path.join(app.builder.outdir, 'examples')
++ if not os.path.exists(outputdir):
++ os.makedirs(outputdir)
++
++ outputdir = os.path.join(outputdir, subdir)
++ if not os.path.exists(outputdir):
++ os.makedirs(outputdir)
++
++ subdirIndexFile = os.path.join(rstdir, 'index.rst')
++ fhsubdirIndex = file(subdirIndexFile, 'w')
++ fhindex.write(' %s/index.rst\n\n'%subdir)
++
++ fhsubdirIndex.write("""\
++.. _%s-examples-index:
++
++##############################################
++%s Examples
++##############################################
++
++.. htmlonly::
++
++ :Release: |version|
++ :Date: |today|
++
++.. toctree::
++ :maxdepth: 1
++
++"""%(subdir, subdir))
++
++ sys.stdout.write(subdir + ", ")
++ sys.stdout.flush()
++
++ data = datad[subdir]
++ data.sort()
++
++ for fullpath, fname, contents in data:
++ basename, ext = os.path.splitext(fname)
++ outputfile = os.path.join(outputdir, fname)
++ #thumbfile = os.path.join(thumb_dir, '%s.png'%basename)
++ #print ' static_dir=%s, basename=%s, fullpath=%s, fname=%s, thumb_dir=%s, thumbfile=%s'%(static_dir, basename, fullpath, fname, thumb_dir, thumbfile)
++
++ rstfile = '%s.rst'%basename
++ outrstfile = os.path.join(rstdir, rstfile)
++
++ fhsubdirIndex.write(' %s\n'%rstfile)
++
++ if not out_of_date(fullpath, outrstfile):
++ continue
++
++ fh = file(outrstfile, 'w')
++ fh.write('.. _%s-%s:\n\n'%(subdir, basename))
++ title = '%s example code: %s'%(subdir, fname)
++ #title = '<img src=%s> %s example code: %s'%(thumbfile, subdir, fname)
++
++
++ fh.write(title + '\n')
++ fh.write('='*len(title) + '\n\n')
++
++ do_plot = (subdir in ('api',
++ 'pylab_examples',
++ 'units',
++ 'mplot3d',
++ 'axes_grid',
++ ) and
++ not noplot_regex.search(contents))
++
++ if do_plot:
++ fh.write("\n\n.. plot:: %s\n\n::\n\n" % fullpath)
++ else:
++ fh.write("[`source code <%s>`_]\n\n::\n\n" % fname)
++ fhstatic = file(outputfile, 'w')
++ fhstatic.write(contents)
++ fhstatic.close()
++
++ # indent the contents
++ contents = '\n'.join([' %s'%row.rstrip() for row in contents.split('\n')])
++ fh.write(contents)
++
++ fh.write('\n\nKeywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`)')
++ fh.close()
++
++ fhsubdirIndex.close()
++
++ fhindex.close()
++
++ print
++
++def setup(app):
++ app.connect('builder-inited', generate_example_rst)
+diff --git a/doc/sphinxext/inheritance_diagram.py b/doc/sphinxext/inheritance_diagram.py
+new file mode 100644
+index 0000000..407fc13
+--- /dev/null
++++ b/doc/sphinxext/inheritance_diagram.py
+@@ -0,0 +1,407 @@
++"""
++Defines a docutils directive for inserting inheritance diagrams.
++
++Provide the directive with one or more classes or modules (separated
++by whitespace). For modules, all of the classes in that module will
++be used.
++
++Example::
++
++ Given the following classes:
++
++ class A: pass
++ class B(A): pass
++ class C(A): pass
++ class D(B, C): pass
++ class E(B): pass
++
++ .. inheritance-diagram: D E
++
++ Produces a graph like the following:
++
++ A
++ / \
++ B C
++ / \ /
++ E D
++
++The graph is inserted as a PNG+image map into HTML and a PDF in
++LaTeX.
++"""
++
++import inspect
++import os
++import re
++import subprocess
++try:
++ from hashlib import md5
++except ImportError:
++ from md5 import md5
++
++from docutils.nodes import Body, Element
++from docutils.parsers.rst import directives
++from sphinx.roles import xfileref_role
++
++def my_import(name):
++ """Module importer - taken from the python documentation.
++
++ This function allows importing names with dots in them."""
++
++ mod = __import__(name)
++ components = name.split('.')
++ for comp in components[1:]:
++ mod = getattr(mod, comp)
++ return mod
++
++class DotException(Exception):
++ pass
++
++class InheritanceGraph(object):
++ """
++ Given a list of classes, determines the set of classes that
++ they inherit from all the way to the root "object", and then
++ is able to generate a graphviz dot graph from them.
++ """
++ def __init__(self, class_names, show_builtins=False):
++ """
++ *class_names* is a list of child classes to show bases from.
++
++ If *show_builtins* is True, then Python builtins will be shown
++ in the graph.
++ """
++ self.class_names = class_names
++ self.classes = self._import_classes(class_names)
++ self.all_classes = self._all_classes(self.classes)
++ if len(self.all_classes) == 0:
++ raise ValueError("No classes found for inheritance diagram")
++ self.show_builtins = show_builtins
++
++ py_sig_re = re.compile(r'''^([\w.]*\.)? # class names
++ (\w+) \s* $ # optionally arguments
++ ''', re.VERBOSE)
++
++ def _import_class_or_module(self, name):
++ """
++ Import a class using its fully-qualified *name*.
++ """
++ try:
++ path, base = self.py_sig_re.match(name).groups()
++ except:
++ raise ValueError(
++ "Invalid class or module '%s' specified for inheritance diagram" % name)
++ fullname = (path or '') + base
++ path = (path and path.rstrip('.'))
++ if not path:
++ path = base
++ try:
++ module = __import__(path, None, None, [])
++ # We must do an import of the fully qualified name. Otherwise if a
++ # subpackage 'a.b' is requested where 'import a' does NOT provide
++ # 'a.b' automatically, then 'a.b' will not be found below. This
++ # second call will force the equivalent of 'import a.b' to happen
++ # after the top-level import above.
++ my_import(fullname)
++
++ except ImportError:
++ raise ValueError(
++ "Could not import class or module '%s' specified for inheritance diagram" % name)
++
++ try:
++ todoc = module
++ for comp in fullname.split('.')[1:]:
++ todoc = getattr(todoc, comp)
++ except AttributeError:
++ raise ValueError(
++ "Could not find class or module '%s' specified for inheritance diagram" % name)
++
++ # If a class, just return it
++ if inspect.isclass(todoc):
++ return [todoc]
++ elif inspect.ismodule(todoc):
++ classes = []
++ for cls in todoc.__dict__.values():
++ if inspect.isclass(cls) and cls.__module__ == todoc.__name__:
++ classes.append(cls)
++ return classes
++ raise ValueError(
++ "'%s' does not resolve to a class or module" % name)
++
++ def _import_classes(self, class_names):
++ """
++ Import a list of classes.
++ """
++ classes = []
++ for name in class_names:
++ classes.extend(self._import_class_or_module(name))
++ return classes
++
++ def _all_classes(self, classes):
++ """
++ Return a list of all classes that are ancestors of *classes*.
++ """
++ all_classes = {}
++
++ def recurse(cls):
++ all_classes[cls] = None
++ for c in cls.__bases__:
++ if c not in all_classes:
++ recurse(c)
++
++ for cls in classes:
++ recurse(cls)
++
++ return all_classes.keys()
++
++ def class_name(self, cls, parts=0):
++ """
++ Given a class object, return a fully-qualified name. This
++ works for things I've tested in matplotlib so far, but may not
++ be completely general.
++ """
++ module = cls.__module__
++ if module == '__builtin__':
++ fullname = cls.__name__
++ else:
++ fullname = "%s.%s" % (module, cls.__name__)
++ if parts == 0:
++ return fullname
++ name_parts = fullname.split('.')
++ return '.'.join(name_parts[-parts:])
++
++ def get_all_class_names(self):
++ """
++ Get all of the class names involved in the graph.
++ """
++ return [self.class_name(x) for x in self.all_classes]
++
++ # These are the default options for graphviz
++ default_graph_options = {
++ "rankdir": "LR",
++ "size": '"8.0, 12.0"'
++ }
++ default_node_options = {
++ "shape": "box",
++ "fontsize": 10,
++ "height": 0.25,
++ "fontname": "Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",
++ "style": '"setlinewidth(0.5)"'
++ }
++ default_edge_options = {
++ "arrowsize": 0.5,
++ "style": '"setlinewidth(0.5)"'
++ }
++
++ def _format_node_options(self, options):
++ return ','.join(["%s=%s" % x for x in options.items()])
++ def _format_graph_options(self, options):
++ return ''.join(["%s=%s;\n" % x for x in options.items()])
++
++ def generate_dot(self, fd, name, parts=0, urls={},
++ graph_options={}, node_options={},
++ edge_options={}):
++ """
++ Generate a graphviz dot graph from the classes that
++ were passed in to __init__.
++
++ *fd* is a Python file-like object to write to.
++
++ *name* is the name of the graph
++
++ *urls* is a dictionary mapping class names to http urls
++
++ *graph_options*, *node_options*, *edge_options* are
++ dictionaries containing key/value pairs to pass on as graphviz
++ properties.
++ """
++ g_options = self.default_graph_options.copy()
++ g_options.update(graph_options)
++ n_options = self.default_node_options.copy()
++ n_options.update(node_options)
++ e_options = self.default_edge_options.copy()
++ e_options.update(edge_options)
++
++ fd.write('digraph %s {\n' % name)
++ fd.write(self._format_graph_options(g_options))
++
++ for cls in self.all_classes:
++ if not self.show_builtins and cls in __builtins__.values():
++ continue
++
++ name = self.class_name(cls, parts)
++
++ # Write the node
++ this_node_options = n_options.copy()
++ url = urls.get(self.class_name(cls))
++ if url is not None:
++ this_node_options['URL'] = '"%s"' % url
++ fd.write(' "%s" [%s];\n' %
++ (name, self._format_node_options(this_node_options)))
++
++ # Write the edges
++ for base in cls.__bases__:
++ if not self.show_builtins and base in __builtins__.values():
++ continue
++
++ base_name = self.class_name(base, parts)
++ fd.write(' "%s" -> "%s" [%s];\n' %
++ (base_name, name,
++ self._format_node_options(e_options)))
++ fd.write('}\n')
++
++ def run_dot(self, args, name, parts=0, urls={},
++ graph_options={}, node_options={}, edge_options={}):
++ """
++ Run graphviz 'dot' over this graph, returning whatever 'dot'
++ writes to stdout.
++
++ *args* will be passed along as commandline arguments.
++
++ *name* is the name of the graph
++
++ *urls* is a dictionary mapping class names to http urls
++
++ Raises DotException for any of the many os and
++ installation-related errors that may occur.
++ """
++ try:
++ dot = subprocess.Popen(['dot'] + list(args),
++ stdin=subprocess.PIPE, stdout=subprocess.PIPE,
++ close_fds=True)
++ except OSError:
++ raise DotException("Could not execute 'dot'. Are you sure you have 'graphviz' installed?")
++ except ValueError:
++ raise DotException("'dot' called with invalid arguments")
++ except:
++ raise DotException("Unexpected error calling 'dot'")
++
++ self.generate_dot(dot.stdin, name, parts, urls, graph_options,
++ node_options, edge_options)
++ dot.stdin.close()
++ result = dot.stdout.read()
++ returncode = dot.wait()
++ if returncode != 0:
++ raise DotException("'dot' returned the errorcode %d" % returncode)
++ return result
++
++class inheritance_diagram(Body, Element):
++ """
++ A docutils node to use as a placeholder for the inheritance
++ diagram.
++ """
++ pass
++
++def inheritance_diagram_directive(name, arguments, options, content, lineno,
++ content_offset, block_text, state,
++ state_machine):
++ """
++ Run when the inheritance_diagram directive is first encountered.
++ """
++ node = inheritance_diagram()
++
++ class_names = arguments
... 900 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/basemap.git
More information about the Python-modules-commits
mailing list