Merge pull request #117 from sam-m888/moveHolidaysToData

7921 Move holidays.xml.in to data [refactor]
This commit is contained in:
Paul Franklin 2016-04-17 04:01:50 +00:00
commit 084830c743
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

@ -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: