Back to index

plone3  3.1.7
Functions | Variables
rebuild-pot Namespace Reference

Functions

def rebuild
def main

Variables

 WIN32 = True
tuple __I18NDUDE = os.environ.get('I18NDUDE', 'i18ndude')
tuple __INSTANCE_HOME = os.environ.get('INSTANCE_HOME', '')

Function Documentation

def rebuild-pot.main ( )

Definition at line 146 of file rebuild-pot.py.

00146 
00147 def main():
00148     if len(sys.argv) < 2:
00149         print 'You have to specify an option.'
00150         sys.exit(1)
00151 
00152     if len(sys.argv) == 2:
00153         rebuild(sys.argv[1])
00154     else:
00155         rebuild(sys.argv[1], sys.argv[2])

def rebuild-pot.rebuild (   product,
  folder = '' 
)

Definition at line 22 of file rebuild-pot.py.

00022 
00023 def rebuild(product, folder=''):
00024     product = getLongProductName(product)
00025 
00026     pot = product + '.pot'
00027     manualpot = '%s-manual.pot' % product
00028     generatedpot = '%s-generated.pot' % product
00029     if '/' in product:
00030         product = product.split('/')[1]
00031 
00032     log = 'rebuild-%s-pot.log' % product
00033     domain = product
00034 
00035     os.chdir('..')
00036     os.chdir('i18n')
00037 
00038     if not os.path.isfile(manualpot):
00039         print 'Manual pot missing for the given product: %s.' % manualpot
00040         sys.exit(3)
00041 
00042     folder2 = ''
00043     if product == 'plone':
00044         packages = (
00045             'archetypes.kss',
00046             'plone.contentrules',
00047             'plone.fieldsets',
00048             'plone.i18n',
00049             'plone.locking',
00050             'plone.memoize',
00051             'plone.openid',
00052             'plone.portlets',
00053             'plone.portlet.collection',
00054             'plone.portlet.static',
00055             'plone.session',
00056             'plone.intelligenttext',
00057             'plone.app.contentmenu',
00058             'plone.app.content',
00059             'plone.app.contentrules',
00060             'plone.app.controlpanel',
00061             'plone.app.customerize',
00062             'plone.app.form',
00063             'plone.app.i18n',
00064             'plone.app.iterate',
00065             'plone.app.kss',
00066             'plone.app.layout',
00067             'plone.app.linkintegrity',
00068             'plone.app.portlets',
00069             'plone.app.redirector',
00070             'plone.app.viewletmanager',
00071             'plone.app.vocabularies',
00072             'plone.app.workflow',
00073             'plone.app.openid',
00074             'Products.Archetypes',
00075             'Products.CMFDiffTool',
00076         )
00077         add_products = (
00078             'Archetypes',
00079             'CMFDiffTool',
00080         )
00081 
00082         src = os.path.join(__INSTANCE_HOME, 'src')
00083         for package in packages:
00084             p = os.path.join(src, package)
00085             if os.path.isdir(p):
00086                 folder2 += ' %s' % p
00087         src = os.path.join(__INSTANCE_HOME, 'products')
00088         for prod in add_products:
00089             p = os.path.join(src, prod)
00090             if os.path.isdir(p):
00091                 folder2 += ' %s' % p
00092 
00093     foldererror = False
00094     if not os.path.isdir(folder) and folder == '':
00095         folder = os.path.join(__INSTANCE_HOME, 'Products')
00096         if os.path.isdir(folder):
00097             folder = os.path.join(folder, getProductPath(product))
00098             if not os.path.isdir(folder):
00099                 # Try the src folder instead
00100                 base = os.path.basename(folder)
00101                 src = os.path.join(__INSTANCE_HOME, 'src')
00102                 package = os.path.join(src, 'Products.%s' % base)
00103                 if os.path.isdir(package):
00104                     folder = package
00105                 else:
00106                     foldererror = True
00107         else:
00108             foldererror = True
00109     else:
00110         foldererror = True
00111 
00112     if foldererror:
00113         print 'Directory (%s) could not be found.' % folder
00114         sys.exit(4)
00115 
00116     # Remove the original file
00117     if os.path.isfile(pot):
00118         os.remove(pot)
00119 
00120     print 'Using %s to build new pot.\n' % folder
00121     cmd = __I18NDUDE + (' rebuild-pot --pot %s --create %s --merge %s ') % (pot, domain, manualpot)
00122     if product == 'plone':
00123         cmd += '--merge2 %s ' % generatedpot
00124     if product == 'plone':
00125         ignores = ('rss_template.pt',
00126                    'metadata_edit_form.cpt',
00127                    'metadirectives.py',
00128                    'Discussion_Item.xml',
00129                   )
00130         cmd += '--exclude="%s" ' % ' '.join(ignores)
00131     if product.startswith('kupu'):
00132         ignores = ('mmbase',
00133                    'widgeteer',
00134                    'kupu_kjax_support.xml.pt',
00135                    'kupu_migration.xml.pt',
00136                   )
00137         cmd += '--exclude="%s" ' % ' '.join(ignores)
00138     if product == 'plone':
00139         cmd += '%s %s > %s 2>&1' % (folder, folder2, log)
00140         # For debugging
00141         # cmd += '%s %s' % (folder, folder2)
00142     else:
00143         cmd += '%s > %s 2>&1' % (folder, log)
00144     print 'Rebuilding to %s - this takes a while, logging to %s' % (pot, log)
00145     os.system(cmd)

Here is the call graph for this function:


Variable Documentation

tuple rebuild-pot.__I18NDUDE = os.environ.get('I18NDUDE', 'i18ndude')

Definition at line 19 of file rebuild-pot.py.

tuple rebuild-pot.__INSTANCE_HOME = os.environ.get('INSTANCE_HOME', '')

Definition at line 20 of file rebuild-pot.py.

rebuild-pot.WIN32 = True

Definition at line 15 of file rebuild-pot.py.