diff --git a/gettext-0.21.tar.xz b/gettext-0.21.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..b1b4a65144718b239fce820744f2c18faef8768a Binary files /dev/null and b/gettext-0.21.tar.xz differ diff --git a/gettext.spec b/gettext.spec new file mode 100644 index 0000000000000000000000000000000000000000..d398d11212ebac86f4ff8a134895404f18cc777e --- /dev/null +++ b/gettext.spec @@ -0,0 +1,389 @@ +%define anolis_release 1 + +%bcond_with jar +%bcond_with java + +%global tarversion 0.21 +%global archiveversion 0.21 + +Summary: GNU libraries and utilities for producing multi-lingual messages +Name: gettext +Version: %{tarversion} +Release: %{anolis_release}%{?dist} +# The following are licensed under LGPLv2+: +# - libintl and its headers +# - libasprintf and its headers +# - libintl.jar +# - GNU.Gettext.dll +# - gettext.sh +# The following are licensed under GFDL: +# - gettext-tools/doc/FAQ.html +# - gettext-tools/doc/tutorial.html +# - gettext info files +# - libasprintf info files +# - libtextstyle info files +# Everything else is GPLv3+ +License: GPLv3+ and LGPLv2+ and GFDL +URL: http://www.gnu.org/software/gettext/ +Source: https://ftp.gnu.org/pub/gnu/gettext/%{name}-%{version}.tar.xz +Source2: msghack.py +Source3: msghack.1 + + +BuildRequires: gcc-c++ +%if %{with java} +# libintl.jar requires gcj >= 4.3 to build +BuildRequires: gcc-java, libgcj +# For javadoc +BuildRequires: java-1.6.0-openjdk-devel +%if %{with jar} +BuildRequires: %{_bindir}/fastjar +# require zip and unzip for brp-java-repack-jars +BuildRequires: zip, unzip +%endif +%endif +# for po-mode.el +BuildRequires: emacs +# for autosetup +BuildRequires: git +# ensure 'ARCHIVE_FORMAT=dirxz' +BuildRequires: xz +# for documentation +BuildRequires: teckit +BuildRequires: texlive-dvips +BuildRequires: texlive-dvipdfmx +BuildRequires: texinfo-tex +BuildRequires: texlive-xetex +# following suggested by DEPENDENCIES: +BuildRequires: ncurses-devel +BuildRequires: libxml2-devel +BuildRequires: glib2-devel +BuildRequires: libacl-devel +BuildRequires: libunistring-devel +# for the tests +BuildRequires: glibc-langpack-de +BuildRequires: glibc-langpack-en +BuildRequires: glibc-langpack-fa +BuildRequires: glibc-langpack-fr +BuildRequires: glibc-langpack-ja +BuildRequires: glibc-langpack-tr +BuildRequires: glibc-langpack-zh +# Depend on the exact version of the library sub package +Requires: %{name}-libs%{_isa} = %{version}-%{release} +Provides: bundled(gnulib) +Provides: bundled(libcroco) = 0.6.12 + +%description +The GNU gettext package provides a set of tools and documentation for +producing multi-lingual messages in programs. Tools include a set of +conventions about how programs should be written to support message +catalogs, a directory and file naming organization for the message +catalogs, a runtime library which supports the retrieval of translated +messages, and stand-alone programs for handling the translatable and +the already translated strings. Gettext provides an easy to use +library and tools for creating, using, and modifying natural language +catalogs and is a powerful and simple method for internationalizing +programs. + + +%package common-devel +Summary: Common development files for %{name} +# autopoint archive +License: GPLv3+ +BuildArch: noarch + +%description common-devel +This package contains common architecture independent gettext development files. + + +%package devel +Summary: Development files for %{name} +# autopoint is GPLv3+ +# libasprintf is LGPLv2+ +# libgettextpo is GPLv3+ +License: LGPLv2+ and GPLv3+ and GFDL +Requires: %{name} = %{version}-%{release} +Requires: %{name}-libs = %{version}-%{release} +Requires: %{name}-common-devel = %{version}-%{release} +Requires: xz +Requires: diffutils +Obsoletes: gettext-autopoint < 0.18.1.1-3 +Provides: gettext-autopoint = %{version}-%{release} + +%description devel +This package contains all development related files necessary for +developing or compiling applications/libraries that needs +internationalization capability. You also need this package if you +want to add gettext support for your project. + + +%package libs +Summary: Libraries for %{name} +# libasprintf is LGPLv2+ +# libgettextpo is GPLv3+ +License: LGPLv2+ and GPLv3+ + +%description libs +This package contains libraries used internationalization support. + + +%package -n libtextstyle +Summary: Text styling library +License: GPLv3+ + +%description -n libtextstyle +Library for producing styled text to be displayed in a terminal +emulator. + + +%package -n libtextstyle-devel +Summary: Development files for libtextstyle +License: GPLv3+ and GFDL +Requires: libtextstyle%{?_isa} = %{version}-%{release} + +%description -n libtextstyle-devel +This package contains all development related files necessary for +developing or compiling applications/libraries that needs text +styling. + + +%package -n emacs-%{name} +Summary: Support for editing po files within GNU Emacs +BuildArch: noarch +# help users find po-mode.el +Provides: emacs-po-mode +Requires: emacs(bin) >= %{_emacs_version} +Provides: emacs-%{name}-el = %{version}-%{release} +Obsoletes: emacs-%{name}-el < %{version}-%{release} + +%description -n emacs-%{name} +This package provides a major mode for editing po files within GNU Emacs. + +%package -n msghack +Summary: Alter PO files in ways +BuildArch: noarch + +%description -n msghack +This program can be used to alter .po files in ways no sane mind would +think about. + + +%prep +%autosetup -n %{name}-%{tarversion} -S git + +# Defeat libtextstyle attempt to bundle libxml2. The comments +# indicate this is done because the libtextstyle authors do not want +# applications using their code to suffer startup delays due to the +sed -e 's/\(gl_cv_libxml_force_included=\)yes/\1no/' \ + -i libtextstyle/configure + + +%build +%if %{with java} +export JAVAC=gcj +%if %{with jar} +export JAR=fastjar +%endif +%endif +export CPPFLAGS="-I%{_includedir}/libxml2" +# Side effect of unbundling libxml2 from libtextstyle. +export LIBS="-lxml2" +%configure --without-included-gettext --enable-nls --disable-static \ + --enable-shared --disable-csharp --disable-rpath \ +%if %{with java} + --enable-java \ +%else + --disable-java --disable-native-java \ +%endif + --with-xz + +# Eliminate hardcoded rpaths; workaround libtool reordering -Wl,--as-needed +# after all the libraries. +sed -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \ + -e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \ + -e 's|CC=.g..|& -Wl,--as-needed|' \ + -i $(find . -name libtool) + +%make_build %{?with_java:GCJFLAGS="-findirect-dispatch"} + + +%install +%make_install \ + lispdir=%{_datadir}/emacs/site-lisp/gettext \ + aclocaldir=%{_datadir}/aclocal EXAMPLESFILES="" + + +install -pm 755 %SOURCE2 ${RPM_BUILD_ROOT}/%{_bindir}/msghack +install -pm 644 %SOURCE3 ${RPM_BUILD_ROOT}/%{_mandir}/man1/msghack.1 + + +# make preloadable_libintl.so executable +chmod 755 ${RPM_BUILD_ROOT}%{_libdir}/preloadable_libintl.so + +rm -f ${RPM_BUILD_ROOT}%{_infodir}/dir + +# doc relocations +for i in gettext-runtime/man/*.html; do + rm ${RPM_BUILD_ROOT}%{_datadir}/doc/gettext/`basename $i` +done +rm -r ${RPM_BUILD_ROOT}%{_datadir}/doc/gettext/javadoc* + +rm -rf ${RPM_BUILD_ROOT}%{_datadir}/doc/gettext/examples + +rm -rf htmldoc +mkdir htmldoc +mv ${RPM_BUILD_ROOT}%{_datadir}/doc/gettext/* ${RPM_BUILD_ROOT}/%{_datadir}/doc/libasprintf/* htmldoc +rm -r ${RPM_BUILD_ROOT}%{_datadir}/doc/libasprintf +rm -r ${RPM_BUILD_ROOT}%{_datadir}/doc/gettext + +## note libintl.jar does not build with gcj < 4.3 +## since it would not be fully portable +%if %{with jar} +### this is no longer needed since examples not packaged +## set timestamp of examples ChangeLog timestamp for brp-java-repack-jars +#for i in `find ${RPM_BUILD_ROOT} examples -newer ChangeLog -type f -name ChangeLog`; do +# touch -r ChangeLog $i +#done +%else +# in case another java compiler is installed +rm -f ${RPM_BUILD_ROOT}%{_datadir}/%{name}/libintl.jar +%endif + +rm -f ${RPM_BUILD_ROOT}%{_datadir}/%{name}/gettext.jar + +# own this directory for third-party *.its files +mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}/its + +# remove .la files +rm ${RPM_BUILD_ROOT}%{_libdir}/lib*.la + +# remove internal .so lib files +rm ${RPM_BUILD_ROOT}%{_libdir}/libgettext{src,lib}.so + +# move po-mode initialization elisp file to the right place, and remove byte +# compiled file +install -d ${RPM_BUILD_ROOT}%{_emacs_sitestartdir} +mv ${RPM_BUILD_ROOT}%{_emacs_sitelispdir}/%{name}/start-po.el ${RPM_BUILD_ROOT}%{_emacs_sitestartdir} +rm ${RPM_BUILD_ROOT}%{_emacs_sitelispdir}/%{name}/start-po.elc + +%find_lang %{name}-runtime +%find_lang %{name}-tools +cat %{name}-*.lang > %{name}.lang + + +%check +# this takes quite a lot of time to run + +# adapt to rpath removal +export LD_LIBRARY_PATH=$RPM_BUILD_ROOT%{_libdir}:$PWD/gettext-tools/intl/.libs + +# override LIBUNISTRING to prevent reordering of lib objects +# FIXME: https://lists.gnu.org/archive/html/bug-gnulib/2020-07/msg00195.html +# make check LIBUNISTRING=-lunistring + +%ldconfig_scriptlets libs + +%files -f %{name}.lang +%doc AUTHORS gettext-runtime/BUGS +%doc COPYING gettext-tools/misc/DISCLAIM README +%doc NEWS THANKS +%doc gettext-runtime/man/*.1.html +%doc gettext-runtime/intl/COPYING* +%{_bindir}/envsubst +%{_bindir}/gettext +%{_bindir}/gettext.sh +%{_bindir}/msgattrib +%{_bindir}/msgcat +%{_bindir}/msgcmp +%{_bindir}/msgcomm +%{_bindir}/msgconv +%{_bindir}/msgen +%{_bindir}/msgexec +%{_bindir}/msgfilter +%{_bindir}/msgfmt +%{_bindir}/msggrep +%{_bindir}/msginit +%{_bindir}/msgmerge +%{_bindir}/msgunfmt +%{_bindir}/msguniq +%{_bindir}/ngettext +%{_bindir}/recode-sr-latin +%{_bindir}/xgettext +%{_infodir}/gettext* +%exclude %{_mandir}/man1/autopoint.1* +%exclude %{_mandir}/man1/gettextize.1* +%exclude %{_mandir}/man1/msghack.1* +%{_mandir}/man1/* +%{_libdir}/%{name} +%if %{with java} +%exclude %{_libdir}/%{name}/gnu.gettext.* +%endif +%dir %{_datadir}/%{name} +%dir %{_datadir}/%{name}/its +%{_datadir}/%{name}/ABOUT-NLS +%{_datadir}/%{name}/po +%{_datadir}/%{name}/styles +%dir %{_datadir}/%{name}-%{tarversion} +%{_datadir}/%{name}-%{tarversion}/its + +%files common-devel +%{_datadir}/%{name}/archive.*.tar.xz + +%files devel +%doc gettext-runtime/man/*.3.html ChangeLog +%{_bindir}/autopoint +%{_bindir}/gettextize +%{_datadir}/%{name}/projects/ +%{_datadir}/%{name}/config.rpath +%{_datadir}/%{name}/*.h +%{_datadir}/%{name}/msgunfmt.tcl +%{_datadir}/aclocal/* +%{_includedir}/autosprintf.h +%{_includedir}/gettext-po.h +%{_infodir}/autosprintf* +%{_libdir}/libasprintf.so +%{_libdir}/libgettextpo.so +%{_libdir}/preloadable_libintl.so +%{_mandir}/man1/autopoint.1* +%{_mandir}/man1/gettextize.1* +%{_mandir}/man3/* +%{_datadir}/%{name}/javaversion.class +%doc gettext-runtime/intl-java/javadoc* +%if %{with java} +%{_libdir}/%{name}/gnu.gettext.* +%endif + +%files libs +%{_libdir}/libasprintf.so.0* +%{_libdir}/libgettextpo.so.0* +%{_libdir}/libgettextlib-0.*.so +%{_libdir}/libgettextsrc-0.*.so +%if %{with jar} +%{_datadir}/%{name}/libintl.jar +%endif + +%files -n libtextstyle +%{_libdir}/libtextstyle.so.0* + +%files -n libtextstyle-devel +%{_docdir}/libtextstyle/ +%{_includedir}/textstyle/ +%{_includedir}/textstyle.h +%{_infodir}/libtextstyle* +%{_libdir}/libtextstyle.so + +%files -n emacs-%{name} +%dir %{_emacs_sitelispdir}/%{name} +%{_emacs_sitelispdir}/%{name}/*.elc +%{_emacs_sitelispdir}/%{name}/*.el +%{_emacs_sitestartdir}/*.el + +%files -n msghack +%license COPYING +%{_bindir}/msghack +%{_mandir}/man1/msghack.1* + +%changelog +* Wed Mar 09 2022 Hongwei Qin - 0.21-1 +- gettext-0.21 is available +- Init for Anolis OS 23 diff --git a/msghack.1 b/msghack.1 new file mode 100644 index 0000000000000000000000000000000000000000..42fcc5b3b3a650e787ac844874e5e0d7cb74d80b --- /dev/null +++ b/msghack.1 @@ -0,0 +1,45 @@ +.TH MSGHACK "1" "June 2013" "msghack" "User Commands" +.SH NAME +msghack \- alter PO files in ways +.SH SYNOPSIS +.B msghack +[\fIOPTION\fR] \fIfile.po \fR[\fIref.po\fR] +.SH DESCRIPTION +.PP +This program can be used to alter .po files in ways no sane mind would think about. +.TP +\fB\-o\fR +result will be written to FILE +.TP +\fB\-\-invert\fR +invert a po file by switching msgid and msgstr +.TP +\fB\-\-master\fR +join any number of files in a master\-formatted catalog +.TP +\fB\-\-empty\fR +empty the contents of the .po file, creating a .pot +.TP +\fB\-\-append\fR +append entries from ref.po that don't exist in file.po +.PP +Note: It is just a replacement of msghack for backward support. +.PP +This program can be used to alter .po files in ways no sane mind would think about. +.TP +\fB\-o\fR +result will be written to FILE +.TP +\fB\-\-invert\fR +invert a po file by switching msgid and msgstr +.TP +\fB\-\-master\fR +join any number of files in a master\-formatted catalog +.TP +\fB\-\-empty\fR +empty the contents of the .po file, creating a .pot +.TP +\fB\-\-append\fR +append entries from ref.po that don't exist in file.po +.PP +Note: It is just a replacement of msghack for backward support. diff --git a/msghack.py b/msghack.py new file mode 100755 index 0000000000000000000000000000000000000000..358552c838da7a447bb0252dcb29af8459dfdb74 --- /dev/null +++ b/msghack.py @@ -0,0 +1,417 @@ +#!/usr/bin/python3 +## -*- coding: utf-8 -*- +## Copyright (C) 2001, 2004, 2008, 2012 Red Hat, Inc. +## Copyright (C) 2001 Trond Eivind Glomsrød + +## This program is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. + +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. + +## You should have received a copy of the GNU General Public License +## along with this program. If not, see . + +""" +A msghack replacement +""" + +import sys + +class GTMessage: + """ + A class containing a message, its msgid and various references pointing at it + """ + + def __init__(self,id=None,message=None,refs=[]): + """ + The constructor for the GTMessage class + @self The object instance + @message The message + @id The messageid associated with the object + """ + self._message=message.strip() + self._id=id.strip() + self._refs=[] + for ref in refs: + self._refs.append(ref) + + def __str__(self): + """ + Return a string representation of the object + @self The object instance + """ + res="" + for ref in self._refs: + res=res+ref+"\n" + res=res+"msgid %s\nmsgstr %s\n" % (self._id,self._message) + return res + + def invertedStrings(self): + """ + Returns a string representation, but with msgid and msgstr inverted. + Note: Don't invert the "" string + @self The object instance + """ + res="" + for ref in self._refs: + res=res+ref+"\n" + if not self._id=="\"\"": + res=res+"msgid %s\nmsgstr %s\n" % (self._message,self._id) + else: + res=res+"msgid %s\nmsgstr %s\n" % (self._id,self._message) + return res + + def emptyMsgStrings(self): + """ + Return a string representation of the object, but leave the msgstr + empty - create a pot file from a po file + Note: Won't remove the "" string + @self The object instance + """ + res="" + for ref in self._refs: + res=res+ref+"\n" + if not self._id=="\"\"": + res=res+"msgid %s\nmsgstr \"\"\n" % (self._id) + else: + res=res+"msgid %s\nmsgstr %s\n" % (self._id,self._message) + return res + + def compareMessage(self,msg): + """ + Return if the messages have identical msgids, 0 otherwise + @self The object instance + @msg The message to compare to + """ + + if self._id == msg._id: + return 1 + return 0 + + +class GTMasterMessage: + """ + A class containing a message, its msgid and various references pointing at it + The difference between GTMessage and GTMasterMessage is that this class + can do less operations, but is able to store multiple msgstrs with identifiers + (usually language, like 'msgst(no)' + """ + + def __init__(self,id=None,refs=[]): + """ + The constructor for the GTMessage class + @self The object instance + @id The messageid associated with the object + """ + self._id=id + self._refs=[] + self._messages=[] + for ref in refs: + self._refs.append(ref) + + def addMessage(self,message,identifier): + """ + Add a new message and identifier to the GTMasterMessage object + @self The object instance + @message The message to append + @identifier The identifier of the message + """ + self._messages.append((identifier,message)) + + def __str__(self): + """ + Return a string representation of the object + @self The object instance + """ + res="" + for ref in self._refs: + res=res+ref+"\n" + res=res+"msgid %s\n" % self._id + for message in self._messages: + res=res+"msgstr(%s) %s\n" %(message[0],message[1]) + res=res+"\n" + return res + +class GTFile: + """ + A class containing the GTMessages contained in a file + """ + + def __init__(self,filename): + """ + The constructor of the GTMFile class + @self The object instance + @filename The file to initialize from + """ + self._filename=filename + self._messages=[] + self.readFile(filename) + + def __str__(self): + """ + Return a string representation of the object + @self The object instance + """ + res="" + for message in self._messages: + res=res+str(message)+"\n" + return res + + def invertedStrings(self): + """ + Return a string representation of the object, with msgid and msgstr + swapped. Will remove duplicates... + @self The object instance + """ + + msght={} + msgar=[] + + for message in self._messages: + if message._id=='""' and len(msgar)==0: + msgar.append(GTMessage(message._id,message._message,message._refs)) + continue + msg=GTMessage(message._message,message._id,message._refs) + if msg._id not in msght: + msght[msg._id]=msg + msgar.append(msg) + else: + msg2=msght[msg._id] + for ref in msg._refs: + msg2._refs.append(ref) + res="" + for message in msgar: + res=res+str(message)+"\n" + return res + + def msgidDupes(self): + """ + Search for duplicates in the msgids. + @self The object instance + """ + msgids={} + res="" + for message in self._messages: + msgid=message._id + if msgid in msgids: + res=res+"Duplicate: %s\n" % (msgid) + else: + msgids[msgid]=1 + return res + + def getMsgstr(self,msgid): + """ + Return the msgstr matching the given id. 'None' if missing + @self The object instance + @msgid The msgid key + """ + + for message in self._messages: + if msgid == message._id: + return message._message + return None + + def emptyMsgStrings(self): + """ + Return a string representation of the object, but leave the msgstr + empty - create a pot file from a po file + @self The object instance + """ + + res="" + for message in self._messages: + res=res+message.emptyMsgStrings()+"\n" + return res + + + def append(self,B): + """ + Append entries from dictionary B which aren't + already present in this dictionary + @self The object instance + @B the dictionary to append messages from + """ + + for message in B._messages: + if not self.getMsgstr(message._id): + self._messages.append(message) + + + def readFile(self,filename): + """ + Read the contents of a file into the GTFile object + @self The object instance + @filename The name of the file to read + """ + + file=open(filename,"r") + msgid="" + msgstr="" + refs=[] + lines=[] + inmsgid=0 + inmsgstr=0 + templines=file.readlines() + for line in templines: + lines.append(line.strip()) + for line in lines: + pos=line.find('"') + pos2=line.rfind('"') + if line and line[0]=="#": + refs.append(line.strip()) + if inmsgstr==0 and line[:6]=="msgstr": + msgstr="" + inmsgstr=1 + inmsgid=0 + if inmsgstr==1: + if pos==-1: + inmsgstr=0 + #Handle entries with and without "" consistently + if msgid[:2]=='""' and len(msgid)>4: + msgid=msgid[2:] + if msgstr[:2]=='""' and len(msgstr)>4: + msgstr=msgstr[2:] + message=GTMessage(msgid,msgstr,refs) + self._messages.append(message) + msgstr="" + msgid="" + refs=[] + else: + msgstr=msgstr+line[pos:pos2+1]+"\n" + if inmsgid==0 and line[:5]=="msgid": + msgid="" + inmsgid=1 + if inmsgid==1: + if pos==-1: + inmsgid=0 + else: + msgid=msgid+line[pos:pos2+1]+"\n" + if msgstr and msgid: + message=GTMessage(msgid,msgstr,refs) + self._messages.append(message) + + +class GTMaster: + """ + A class containing a master catalogue of gettext dictionaries + """ + + def __init__(self,dicts): + """ + The constructor for the GTMaster class + @self The object instance + @dicts An array of dictionaries to merge + """ + self._messages=[] + self.createMaster(dicts) + + def createMaster(self,dicts): + """ + Create the master catalogue + @self The object instance + @dicts An array of dictionaries to merge + """ + + self._master=dicts[0] + self._dicts=dicts[1:] + + for message in self._master._messages: + gtm=GTMasterMessage(message._id,message._refs) + gtm.addMessage(message._message,self._master._filename[:-3]) + for dict in self._dicts: + res=dict.getMsgstr(message._id) + if(res): + gtm.addMessage(res,dict._filename[:-3]) + self._messages.append(gtm) + + def __str__(self): + """ + Return a string representation of the object + @self The object instance + """ + res="" + for message in self._messages: + res=res+str(message)+"\n" + return res + +def printUsage(): + "Print the usage messages" + print("Usage: " + str(sys.argv[0]) + " [OPTION] file.po [ref.po]\n\ +This program can be used to alter .po files in ways no sane mind would think about.\n\ + -o result will be written to FILE\n\ + --invert invert a po file by switching msgid and msgstr\n\ + --master join any number of files in a master-formatted catalog\n\ + --empty empty the contents of the .po file, creating a .pot\n\ + --append append entries from ref.po that don't exist in file.po\n\ +\n\ +Note: It is just a replacement of msghack for backward support.\n") + + +if __name__=="__main__": + output=None + res=None + if("-o") in sys.argv: + if (len(sys.argv)<=sys.argv.index("-o")+1): + print("file.po and ref.po are not specified!\n") + printUsage() + exit(1) + output=sys.argv[sys.argv.index("-o")+1] + sys.argv.remove("-o") + sys.argv.remove(output) + if("--invert") in sys.argv: + if (len(sys.argv)<=sys.argv.index("--invert")+1): + print("file.po is not specified!\n") + printUsage() + exit(1) + file=sys.argv[sys.argv.index("--invert")+1] + gtf=GTFile(file) + res1=gtf.msgidDupes() + if res1: + sys.stderr.write(res1) + sys.exit(1) + res=str(gtf.invertedStrings()) + elif("--empty") in sys.argv: + if (len(sys.argv)<=sys.argv.index("--empty")+1): + print("file.po is not specified!\n") + printUsage() + exit(1) + file=sys.argv[sys.argv.index("--empty")+1] + gtf=GTFile(file) + res=str(gtf.emptyMsgStrings()) + elif("--master") in sys.argv: + if (len(sys.argv)<=sys.argv.index("--master")+1): + print("file.po is not specified!\n") + printUsage() + exit(1) + loc=sys.argv.index("--master")+1 + gtfs=[] + for file in sys.argv[loc:]: + gtfs.append(GTFile(file)) + master=GTMaster(gtfs) + res=str(master) + elif("--append") in sys.argv: + if (len(sys.argv)<=sys.argv.index("--append")+2): + print("file.po and/or ref.po are not specified!\n") + printUsage() + exit(1) + file=sys.argv[sys.argv.index("--append")+1] + file2=sys.argv[sys.argv.index("--append")+2] + gtf=GTFile(file) + gtf2=GTFile(file2) + gtf.append(gtf2) + res=str(gtf) + else: + #print("Not implemented: "+str(sys.argv)) + printUsage() + sys.exit(1) + if not output: + print(res) + else: + file=open(output,"w") + file.write(res) + sys.exit(0)