[Python-modules-commits] [cf-python] 09/11: merge patched into master

Klaus Zimmermann zklaus-guest at moszumanska.debian.org
Wed Sep 14 15:09:48 UTC 2016


This is an automated email from the git hooks/post-receive script.

zklaus-guest pushed a commit to branch master
in repository cf-python.

commit 023b6e77a10bb0d7ebfbedd6793a0abf4c4af629
Merge: 23a576a c48f0fe
Author: Klaus Zimmermann <klaus_zimmermann at gmx.de>
Date:   Wed Sep 14 14:43:50 2016 +0200

    merge patched into master

 cf/units.py                                        |  76 +++++++++++---
 debian/.git-dpm                                    |   4 +-
 .../0004-Remove-special-udunits2-database.patch    | 114 +++++++++++++++++++++
 debian/patches/series                              |   1 +
 4 files changed, 180 insertions(+), 15 deletions(-)

diff --cc debian/.git-dpm
index 90ad041,0000000..60659d1
mode 100644,000000..100644
--- a/debian/.git-dpm
+++ b/debian/.git-dpm
@@@ -1,8 -1,0 +1,8 @@@
 +# see git-dpm(1) from git-dpm package
- 9f939f75126666052b245cf7ff99a19db9f134ca
- 9f939f75126666052b245cf7ff99a19db9f134ca
++c48f0febdc84e387bbe377f83db5c4af05fb138e
++c48f0febdc84e387bbe377f83db5c4af05fb138e
 +a946e1c7699a0b716a845f590b53bc022f1e1cdc
 +a946e1c7699a0b716a845f590b53bc022f1e1cdc
 +cf-python_1.3.1+dfsg.1.orig.tar.gz
 +e98ea2bbde60a17d6b7177bee64bb6e3d0b293aa
 +2312964
diff --cc debian/patches/0004-Remove-special-udunits2-database.patch
index 0000000,0000000..01b605b
new file mode 100644
--- /dev/null
+++ b/debian/patches/0004-Remove-special-udunits2-database.patch
@@@ -1,0 -1,0 +1,114 @@@
++From c48f0febdc84e387bbe377f83db5c4af05fb138e Mon Sep 17 00:00:00 2001
++From: Klaus Zimmermann <klaus_zimmermann at gmx.de>
++Date: Wed, 14 Sep 2016 14:42:49 +0200
++Subject: Remove special udunits2 database.
++
++This removes the dependence of the program on the special cf udunits2
++database. The changes are now performed programmatically.
++
++Signed-off-by: Klaus Zimmermann <klaus_zimmermann at gmx.de>
++---
++ cf/units.py | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++-----------
++ 1 file changed, 63 insertions(+), 13 deletions(-)
++
++diff --git a/cf/units.py b/cf/units.py
++index afbe7bf..ada337c 100644
++--- a/cf/units.py
+++++ b/cf/units.py
++@@ -42,18 +42,6 @@ if sys.platform == 'darwin':
++ else:
++     # Linux
++     _udunits = ctypes.CDLL('libudunits2.so.0')
++-
++-# Get the name of the XML-formatted unit-database
++-_unit_database = os.path.join(os.path.dirname(__file__),
++-                              'etc/udunits/udunits2.xml')
++-
++-if os.path.isfile(_unit_database):
++-    # The database included with this module exists, so use it
++-    _unit_database = _c_char_p(_unit_database)
++-else:
++-    # Use the default (non-CF) database
++-    print 'WARNING: Using the default (non-CF) Udunits database'
++-    _unit_database = None
++ #--- End: if
++ 
++ # Suppress "overrides prefixed-unit" messages. This also suppresses
++@@ -76,7 +64,7 @@ _ut_read_xml.argtypes = (_c_char_p, )
++ _ut_read_xml.restype = _c_void_p
++ 
++ #print 'units: before _udunits.ut_read_xml(',_unit_database,')'
++-_ut_system = _ut_read_xml(_unit_database)
+++_ut_system = _ut_read_xml(None)
++ #print 'units: after  _udunits.ut_read_xml(',_unit_database,')'
++ 
++ # Reinstate the reporting of error messages
++@@ -194,6 +182,68 @@ _UT_DEFINITION = 8
++ _cv_convert_array = {4: _cv_convert_floats,
++                      8: _cv_convert_doubles}
++ 
+++# Some function definitions necessary for the following
+++# changes to the unit system.
+++_ut_get_unit_by_name = _udunits.ut_get_unit_by_name
+++_ut_get_unit_by_name.argtypes = (_c_void_p, _c_char_p)
+++_ut_get_unit_by_name.restype = _c_void_p
+++_ut_get_status = _udunits.ut_get_status
+++_ut_get_status.restype = _c_int
+++_ut_unmap_symbol_to_unit = _udunits.ut_unmap_symbol_to_unit
+++_ut_unmap_symbol_to_unit.argtypes = (_c_void_p, _c_char_p, _c_int)
+++_ut_unmap_symbol_to_unit.restype = _c_int
+++_ut_map_symbol_to_unit = _udunits.ut_map_symbol_to_unit
+++_ut_map_symbol_to_unit.argtypes = (_c_char_p, _c_int, _c_void_p)
+++_ut_map_symbol_to_unit.restype = _c_int
+++_ut_map_unit_to_symbol = _udunits.ut_map_unit_to_symbol
+++_ut_map_unit_to_symbol.argtypes = (_c_void_p, _c_char_p, _c_int)
+++_ut_map_unit_to_symbol.restype = _c_int
+++_ut_map_name_to_unit = _udunits.ut_map_name_to_unit
+++_ut_map_name_to_unit.argtypes = (_c_char_p, _c_int, _c_void_p)
+++_ut_map_name_to_unit.restype = _c_int
+++_ut_map_unit_to_name = _udunits.ut_map_unit_to_name
+++_ut_map_unit_to_name.argtypes = (_c_void_p, _c_char_p, _c_int)
+++_ut_map_unit_to_name.restype = _c_int
+++_ut_new_base_unit = _udunits.ut_new_base_unit
+++_ut_new_base_unit.argtypes = (_c_void_p, )
+++_ut_new_base_unit.restype = _c_void_p
+++
+++# Change Sv mapping. Both sievert and sverdrup are just aliases,
+++# so no unit to symbol mapping needs to be changed.
+++# We don't need to remove rem, since it was constructed with
+++# the correct sievert mapping in place; because that mapping
+++# was only an alias, the unit now doesn't depend on the mapping
+++# persisting.
+++assert(0 == _ut_unmap_symbol_to_unit(_ut_system, _c_char_p('Sv'), _UT_ASCII))
+++assert(0 == _ut_map_symbol_to_unit(_c_char_p('Sv'), _UT_ASCII,
+++                                   _ut_get_unit_by_name(_ut_system, _c_char_p('sverdrup'))))
+++
+++# Add new base unit calendar_year
+++calendar_year_unit = _ut_new_base_unit(_ut_system)
+++assert(0 == _ut_map_symbol_to_unit(_c_char_p('cY'), _UT_ASCII, calendar_year_unit))
+++assert(0 == _ut_map_unit_to_symbol(calendar_year_unit, _c_char_p('cY'), _UT_ASCII))
+++assert(0 == _ut_map_name_to_unit(_c_char_p('calendar_year'), _UT_ASCII, calendar_year_unit))
+++assert(0 == _ut_map_unit_to_name(calendar_year_unit, _c_char_p('calendar_year'), _UT_ASCII))
+++assert(0 == _ut_map_name_to_unit(_c_char_p('calendar_years'), _UT_ASCII, calendar_year_unit))
+++
+++# Add various aliases useful for CF.
+++def add_unit_alias(definition, symbol, singular, plural):
+++    unit = _ut_parse(_ut_system, _c_char_p(definition), _UT_ASCII)
+++    if symbol is not None:
+++        assert(0 == _ut_map_symbol_to_unit(_c_char_p(symbol), _UT_ASCII, unit))
+++    if singular is not None:
+++        assert(0 == _ut_map_name_to_unit(_c_char_p(singular), _UT_ASCII, unit))
+++    if plural is not None:
+++        assert(0 == _ut_map_name_to_unit(_c_char_p(plural), _UT_ASCII, unit))
+++
+++add_unit_alias("1.e-3", "psu", "practical_salinity_unit", "practical_salinity_units")
+++add_unit_alias("calendar_year/12", "cM", "calendar_month", "calendar_months")
+++add_unit_alias("1", None, "level", "levels")
+++add_unit_alias("1", None, "layer", "layers")
+++add_unit_alias("1", None, "sigma_level", "sigma_levels")
+++add_unit_alias("1", "dB", "decibel", "debicels")
+++add_unit_alias("10 dB", None, "bel", "bels")
+++
++ #_udunits.ut_get_unit_by_name(_udunits.ut_new_base_unit(_ut_system),
++ #                             _ut_system, 'calendar_year')
++ 
diff --cc debian/patches/series
index 0980737,0000000..fda2bb4
mode 100644,000000..100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@@ -1,3 -1,0 +1,4 @@@
 +0001-Remove-check-for-python-version.patch
 +0002-Added-stripping-of-type-lib.patch
 +0003-Patch-sphinx-config-to-avoid-network-access-and-add-.patch
++0004-Remove-special-udunits2-database.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/cf-python.git



More information about the Python-modules-commits mailing list