7066: use sdn module from Calendar package on pypi
Unfortunately, no package on ubuntu for sdn... Bug fixed on trunk, when sdn is present on the system. Verified that sdn roundtrip works. date_test now fails on 1789-13-4(French) recognized as invalid, as it probably should -- I guess this one is a test bug. svn: r23127
This commit is contained in:
parent
4d82a70eaa
commit
a58b5cf2b7
@ -23,7 +23,7 @@
|
||||
"""
|
||||
Provide calendar to sdn (serial date number) conversion.
|
||||
"""
|
||||
from __future__ import division
|
||||
from __future__ import division, print_function
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Python modules
|
||||
@ -261,7 +261,7 @@ def hebrew_sdn(year, month, day):
|
||||
return sdn + _HBR_SDN_OFFSET
|
||||
|
||||
def hebrew_ymd(sdn):
|
||||
"""Convert an SDN number to a Julian calendar date."""
|
||||
"""Convert an SDN number to a Hebrew calendar date."""
|
||||
|
||||
input_day = sdn - _HBR_SDN_OFFSET
|
||||
|
||||
@ -573,3 +573,14 @@ def swedish_ymd(sdn):
|
||||
return gregorian_ymd(sdn)
|
||||
else:
|
||||
return julian_ymd(sdn)
|
||||
|
||||
try:
|
||||
import sdn
|
||||
|
||||
hebrew_ymd = sdn.SdnToJewish # Fix bug# 7066
|
||||
hebrew_sdn = sdn.JewishToSdn
|
||||
#TODO maybe alias the other local invented wheels to Calendar convertors
|
||||
except ImportError:
|
||||
import sys
|
||||
print("No sdn module. Install Calendar with pypi."
|
||||
"hebrew_sdn has a known bug# 7066!!!", file=sys.stderr)
|
||||
|
@ -320,6 +320,12 @@ def show_settings():
|
||||
except:
|
||||
gsversion_str = 'Ghostscript not in system PATH'
|
||||
|
||||
try:
|
||||
import sdn
|
||||
sdn_str = sdn.__version__
|
||||
except ImportError:
|
||||
sdn_str = 'not found'
|
||||
|
||||
os_path = os.environ.get('PATH','not set')
|
||||
os_path = os_path.split(os.pathsep)
|
||||
|
||||
@ -342,6 +348,7 @@ def show_settings():
|
||||
print (' GExiv2 : %s' % gexiv2_str)
|
||||
print (' ICU : %s' % icu_str)
|
||||
print (' PyICU : %s' % pyicu_str)
|
||||
print (' sdn : %s' % sdn_str)
|
||||
print (' o.s. : %s' % sys.platform)
|
||||
if kernel:
|
||||
print (' kernel : %s' % kernel)
|
||||
|
Loading…
Reference in New Issue
Block a user