Package: bsdmainutils Version: 8.0.11 Severity: normal Tags: patch File: /usr/share/calendar/calendar.judaic
calendar.judaic was last updated in 2007. Due to the nature of the Jewish calendar, it renders the file unusable. To address the difficulties facing the maintainer, a python script is included. This script offers the maintainer a way to create the file as required. The script is not limited to a single year. Just enter the desired year as an argument in the command line. I suggest to keep this script in the Debian directory of the source package. $ cat calendarJudaic.py #! /usr/bin/python # Filename: calendarJudaic.py # # License: no warranty close + no license (public domain) # # Creates a calendar.judaic file, which is suitable for inclusion # in Debian's bsdmainutils package. Up to the introductory of # this script the calendar.judaic file was not updated regularly. # Probably because updating it is time consuming. This python # script let anyone create that file, for any year. Its output is # written to stdout. It requires the libhdate-python package. # A small part of the holidays might require manual editing # because the state of Israel modifies the actual date by a few # days due to various considerations. # References: # http://www.mail-archive.com/[email protected]/msg58169.html # http://www.mail-archive.com/[email protected]/msg58321.html # http://www.mail-archive.com/[email protected]/msg58451.html from string import Template import hdate, optparse, sys, time def main(): description = '''Description: Creates a calendar.judaic file, which is suitable for inclusion in Debian's bsdmainutils package. Up to the introductory of this script the calendar.judaic file was not updated regulary. Probably because updating it is time consuming. This python script let anyone create that file, for any year. Its output is written to stdout. It requires the libhdate-python package. A small part of the holydays might require manual editing because the state of Israel modifies the actual date by a few days due to various considerations. ''' usage = "Usage: %prog [year]\n"\ " %prog [--help|--version]\n"\ "\n"\ "Example: %prog" version = "29-May-2010" parser = optparse.OptionParser(description=description, usage=usage, version=version) (options, args) = parser.parse_args() if len(args)> 1: parser.error("\n " + str(len(args)) + " arguments were " "given. At most 1, an integer represnting a year, " "is expected." ) elif len(args) == 1: # An integer represnting a year is expected. try: year = int(args[0]) except ValueError: parser.error("\n Could not convert the argument " + args[0] + ", which should represent a year, to an integer." ) else: # len(args) == 0, no args were given. Use the current year. year = time.localtime().tm_year h = hdate.Hdate() template_for_header = '''/* * Judaic Calendar. Created by calendar.judaic.py. * Collaboratively authored by [email protected]. * * $$Debian GNU\Linux$$ * */ /* * $$Id: calendarJudaic.py,v ${PLACE_HOLDER_FOR_VERSION}$$ */ #ifndef _calendar_judaic_ #define _calendar_judaic_ LANG=UTF-8 /* * Jewish calendar for the CE year ${PLACE_HOLDER_FOR_THR_CE_YEAR} * ${PLACE_HOLDER_FOR_THE_JEWISH_START_OF_THE_CE_YEAR} - ${PLACE_HOLDER_FOR_THE_JEWISH_END_OF_THE_CE_YEAR} */ ''' footer = ''' #endif /* !_calendar_judaic_ */''' substitutions_for_header = { 'PLACE_HOLDER_FOR_VERSION' : version, 'PLACE_HOLDER_FOR_THR_CE_YEAR' : str(year) } h.set_gdate(1, 1, year) substitutions_for_header[ 'PLACE_HOLDER_FOR_THE_JEWISH_START_OF_THE_CE_YEAR'] = \ h.get_format_date(h.get_julian()) + ' ' + \ h.get_hebrew_year_string() h.set_gdate(31, 12, year) substitutions_for_header[ 'PLACE_HOLDER_FOR_THE_JEWISH_END_OF_THE_CE_YEAR'] = \ h.get_format_date(h.get_julian()) + ' ' + \ h.get_hebrew_year_string() header = Template(template_for_header).substitute( substitutions_for_header) print header h.set_gdate(1, 1, year) julian = h.get_julian() for i in range(0, 365): h.set_jd(julian) julian += 1 day = h.get_gday() month = h.get_gmonth() holyday = { 'Israel' : None, 'diaspora' : None } parasha = { 'Israel' : None, 'diaspora' : None } h.set_israel holyday['Israel'] = h.get_holyday_string(0) parasha['Israel'] = h.get_parasha_string(0) h.set_diaspora holyday['diaspora'] = h.get_holyday_string(0) parasha['diaspora'] = h.get_parasha_string(0) if holyday['Israel']: if holyday['Israel'] == holyday['diaspora']: print "%02d/%02d* %s" % (day, month, holyday['Israel']) else: print "%02d/%02d* %s (Israel only)" % \ (day, month, holyday['Israel']) elif holyday['diaspora']: print "%02d/%02d* %s (diaspora only)" % \ (day, month, holyday['diaspora']) if parasha['Israel']: if parasha['Israel'] == parasha['diaspora']: print "%02d/%02d* Parshat %s" % \ (day, month, parasha['Israel']) else: print "%02d/%02d* %s (Israel only)" % \ (day, month, parasha['Israel']) elif parasha['diaspora'] and parasha['diaspora'] != 'none': # See http://bugs.debian.org/583092 why 'none' is required here. print "%02d/%02d* Parshat %s (diaspora only)" % \ (day, month, parasha['diaspora']) print footer sys.exit() if __name__ == "__main__": main() else: # The following is useful from within an interactive Python # interpreter, where calendarJudaic.py is in the same `pwd`: # >>> import calendarJudaic pass _________________________________________________________________ גישה לדואר אלקטרוני ולשירותים נוספים גם בנסיעות. קבל את Windows Live Hotmail בחינם. https://signup.live.com/signup.aspx?id=60969

