7921 Move holidays.xml.in to data [refactor]

This commit is contained in:
Sam Manzi 2016-04-16 16:38:43 +10:00
parent 98ee53aa17
commit 8694c7fcc7
7 changed files with 16 additions and 16 deletions

2
.gitignore vendored
View File

@ -8,7 +8,7 @@ dist/
# Gramps # Gramps
data/tips.xml data/tips.xml
gramps/plugins/lib/holidays.xml data/holidays.xml
po/.intltool-merge-cache po/.intltool-merge-cache
docs/_build/ docs/_build/

View File

@ -22,7 +22,7 @@ recursive-include windows *
# Remove files created in the build # Remove files created in the build
exclude data/tips.xml exclude data/tips.xml
exclude gramps/plugins/lib/holidays.xml exclude data/holidays.xml
exclude po/.intltool-merge-cache exclude po/.intltool-merge-cache
global-exclude *.pyc global-exclude *.pyc
global-exclude *.pyo global-exclude *.pyo

View File

@ -48,7 +48,7 @@
<date name="Възнесение господне" value="2010/5/13" type="religious" /> <date name="Възнесение господне" value="2010/5/13" type="religious" />
<date name="Възнесение господне" value="2011/6/2" type="religious" /> <date name="Възнесение господне" value="2011/6/2" type="religious" />
<date name="Възнесение господне" value="2012/5/24" type="religious" /> <date name="Възнесение господне" value="2012/5/24" type="religious" />
</country> </country>
<country _name="Canada"> <country _name="Canada">
<date name="New Year's Day" value="*/1/1" type="national" /> <date name="New Year's Day" value="*/1/1" type="national" />
<date name="Groundhog Day" value="*/2/2" type="secular" /> <date name="Groundhog Day" value="*/2/2" type="secular" />
@ -117,14 +117,14 @@
<date name="Día de la Raza" value="*/10/12" type="national" /> <date name="Día de la Raza" value="*/10/12" type="national" />
<date name="Todos los Santos" value="*/11/1" type="religious" /> <date name="Todos los Santos" value="*/11/1" type="religious" />
<date name="Inmaculada Concepción" value="*/12/8" type="religious" /> <date name="Inmaculada Concepción" value="*/12/8" type="religious" />
<date name="Navidad" value="*/12/25" type="national" /> <date name="Navidad" value="*/12/25" type="national" />
</country> </country>
<country _name="China"> <country _name="China">
<date name="Chinese New Year" value="2006/1/29" type="national" /> <date name="Chinese New Year" value="2006/1/29" type="national" />
</country> </country>
<country _name="Croatia"> <country _name="Croatia">
<date name="Nova godina" value="*/1/1" type="national" /> <date name="Nova godina" value="*/1/1" type="national" />
<date name="Sveta tri kralja" value="*/1/6" type="national" /> <date name="Sveta tri kralja" value="*/1/6" type="national" />
<date name="Uskrs" value="> easter(y)" type="national" /> <date name="Uskrs" value="> easter(y)" type="national" />
<date name="Uskršnji ponedjeljak" value="> easter(y)" offset="1" type="national" /> <date name="Uskršnji ponedjeljak" value="> easter(y)" offset="1" type="national" />
<date name="Dan rada" value="*/5/1" type="national" /> <date name="Dan rada" value="*/5/1" type="national" />
@ -481,7 +481,7 @@
<date value="*/dec/26" type="national" name="Boxing Day"/> <date value="*/dec/26" type="national" name="Boxing Day"/>
<date value="*/dec/25" type="national" offset="+2" name="Christmas Day Holiday" if="dow(y, m, d) > 5"/> <date value="*/dec/25" type="national" offset="+2" name="Christmas Day Holiday" if="dow(y, m, d) > 5"/>
<date value="*/dec/26" type="national" offset="+2" name="Boxing Day Holiday" if="dow(y, m, d) > 5"/> <date value="*/dec/26" type="national" offset="+2" name="Boxing Day Holiday" if="dow(y, m, d) > 5"/>
</country> </country>
<country _name="Ukraine"> <country _name="Ukraine">
<date value="*/1/1" type="national" name="Новий Рік"/> <date value="*/1/1" type="national" name="Новий Рік"/>
<date value="*/1/6" type="religious" name="Святий Вечір"/> <date value="*/1/6" type="religious" name="Святий Вечір"/>

View File

@ -38,7 +38,7 @@ import os
#------------------------------------------------------------------------ #------------------------------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext _ = glocale.translation.gettext
from gramps.gen.const import PLUGINS_DIR, USER_PLUGINS from gramps.gen.const import PLUGINS_DIR, USER_PLUGINS, DATA_DIR
from gramps.gen.lib.gcalendar import (gregorian_ymd, hebrew_sdn) from gramps.gen.lib.gcalendar import (gregorian_ymd, hebrew_sdn)
#------------------------------------------------------------------------ #------------------------------------------------------------------------
@ -188,9 +188,9 @@ class HolidayTable(object):
if os.path.exists(holiday_full_path): if os.path.exists(holiday_full_path):
HolidayTable.__holiday_files.append(holiday_full_path) HolidayTable.__holiday_files.append(holiday_full_path)
# Look for holiday files in the installation plugins directory and all # Look for holiday files in the installation data directory and all
# subdirectories. # subdirectories.
for (dirpath, dirnames, filenames) in os.walk(PLUGINS_DIR): for (dirpath, dirnames, filenames) in os.walk(DATA_DIR):
holiday_full_path = os.path.join(dirpath, holiday_file) holiday_full_path = os.path.join(dirpath, holiday_file)
if os.path.exists(holiday_full_path): if os.path.exists(holiday_full_path):
HolidayTable.__holiday_files.append(holiday_full_path) HolidayTable.__holiday_files.append(holiday_full_path)

View File

@ -624,7 +624,6 @@ gramps/plugins/importer/importgrdb.py
gramps/plugins/importer/importprogen.py gramps/plugins/importer/importprogen.py
gramps/plugins/importer/importvcard.py gramps/plugins/importer/importvcard.py
gramps/plugins/importer/importxml.py gramps/plugins/importer/importxml.py
gramps/plugins/lib/holidays.xml.in
gramps/plugins/lib/libcairodoc.py gramps/plugins/lib/libcairodoc.py
gramps/plugins/lib/libgedcom.py gramps/plugins/lib/libgedcom.py
gramps/plugins/lib/libhtmlbackend.py gramps/plugins/lib/libhtmlbackend.py
@ -752,5 +751,6 @@ gramps/plugins/webstuff/webstuff.py
data/gramps.desktop.in data/gramps.desktop.in
data/gramps.keys.in data/gramps.keys.in
data/gramps.xml.in data/gramps.xml.in
data/holidays.xml.in
data/tips.xml.in data/tips.xml.in
data/gramps.appdata.xml.in data/gramps.appdata.xml.in

View File

@ -215,7 +215,7 @@ def HolidaysParse(filename, mark):
msgid "Yom Kippur" msgid "Yom Kippur"
''' '''
holidays = open('../gramps/plugins/lib/holidays.xml.in.h', 'w') holidays = open('../data/holidays.xml.in.h', 'w')
for key in ellist: for key in ellist:
if key.attrib.get(mark): if key.attrib.get(mark):
line = key.attrib line = key.attrib
@ -224,7 +224,7 @@ def HolidaysParse(filename, mark):
name = 'char *s = N_("%(_name)s");\n' % line name = 'char *s = N_("%(_name)s");\n' % line
holidays.write(name) holidays.write(name)
holidays.close() holidays.close()
print ('Wrote ../gramps/plugins/lib/holidays.xml.in.h') print ('Wrote .../data/holidays.xml.in.h')
root.clear() root.clear()
@ -538,8 +538,8 @@ def headers():
# in.h; extract_xml # in.h; extract_xml
if os.path.isfile('''../data/tips.xml.in.h'''): if os.path.isfile('''../data/tips.xml.in.h'''):
headers.append('''../data/tips.xml.in.h''') headers.append('''../data/tips.xml.in.h''')
if os.path.isfile('''../gramps/plugins/lib/holidays.xml.in.h'''): if os.path.isfile('''../data/holidays.xml.in.h'''):
headers.append('''../gramps/plugins/lib/holidays.xml.in.h''') headers.append('''../data/holidays.xml.in.h''')
if os.path.isfile('''../data/gramps.xml.in.h'''): if os.path.isfile('''../data/gramps.xml.in.h'''):
headers.append('''../data/gramps.xml.in.h''') headers.append('''../data/gramps.xml.in.h''')
if os.path.isfile('''../data/gramps.desktop.in.h'''): if os.path.isfile('''../data/gramps.desktop.in.h'''):
@ -559,7 +559,7 @@ def extract_xml():
files. Own XML files parsing and custom translation marks. files. Own XML files parsing and custom translation marks.
""" """
HolidaysParse('../gramps/plugins/lib/holidays.xml.in', '_name') HolidaysParse('../data/holidays.xml.in', '_name')
TipsParse('../data/tips.xml.in', '_tip') TipsParse('../data/tips.xml.in', '_tip')
XmlParse('../data/gramps.xml.in', '_comment') XmlParse('../data/gramps.xml.in', '_comment')
XmlParse('../data/gramps.appdata.xml.in', '_p') XmlParse('../data/gramps.appdata.xml.in', '_p')

View File

@ -54,7 +54,7 @@ ALL_LINGUAS = ('ar', 'bg', 'ca', 'cs', 'da', 'de', 'el', 'en_GB',
'ja', 'lt', 'nb', 'nl', 'nn', 'pl', 'pt_BR', 'pt_PT', 'ja', 'lt', 'nb', 'nl', 'nn', 'pl', 'pt_BR', 'pt_PT',
'ru', 'sk', 'sl', 'sq', 'sr', 'sv', 'tr', 'uk', 'vi', 'ru', 'sk', 'sl', 'sq', 'sr', 'sv', 'tr', 'uk', 'vi',
'zh_CN', 'zh_HK', 'zh_TW') 'zh_CN', 'zh_HK', 'zh_TW')
INTLTOOL_FILES = ('data/tips.xml', 'gramps/plugins/lib/holidays.xml') INTLTOOL_FILES = ('data/tips.xml', 'data/holidays.xml')
svem_flag = '--single-version-externally-managed' svem_flag = '--single-version-externally-managed'
if svem_flag in sys.argv: if svem_flag in sys.argv: