Modify

Opened 6 months ago

Closed 6 months ago

Last modified 5 months ago

#11606 closed defect (fixed)

Cannot install ThemeEnginePlugin 2.2.2 cause of "running compile_catalog_js"

Reported by: jun66j5 Owned by: olemis
Priority: normal Component: ThemeEnginePlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description

bdist_egg command raises the following error. Also easy_install raises the same. The issue is originally from http://14code.com/blog/20140303_664.

$ ~/venv/trac/0.12.5/bin/python setup.py bdist_egg
running bdist_egg
running egg_info
writing requirements to TracThemeEngine.egg-info/requires.txt
writing TracThemeEngine.egg-info/PKG-INFO
writing top-level names to TracThemeEngine.egg-info/top_level.txt
writing dependency_links to TracThemeEngine.egg-info/dependency_links.txt
writing entry points to TracThemeEngine.egg-info/entry_points.txt
reading manifest file 'TracThemeEngine.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '*.swp' found anywhere in distribution
warning: no previously-included files matching '*.swo' found anywhere in distribution
warning: no previously-included files matching '*.mo' found anywhere in distribution
writing manifest file 'TracThemeEngine.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-i686/egg
running install_lib
running compile_catalog_js
error: you must specify either the input file or the base directory

The plugin seems that it should use get_l10n_cmdclass instead of get_l10n_js_cmdclass, as it doesn't use message files for javascript.

  • setup.py

     
    1414 
    1515extra = {} 
    1616try: 
    17     from trac.util.dist import get_l10n_js_cmdclass 
    18     cmdclass = get_l10n_js_cmdclass() 
     17    from trac.util.dist import get_l10n_cmdclass 
     18    cmdclass = get_l10n_cmdclass() 
    1919    if cmdclass: 
    2020        extra['cmdclass'] = cmdclass 
    2121        extractors = [ 

Attachments (0)

Change History (11)

comment:1 Changed 6 months ago by olemis

  • Resolution set to fixed
  • Status changed from new to closed

In 13718:

ThemeEnginePlugin [ fixes #11606 ] : Include the right i18n distutils cmd (no js)

... formerly breaking bdist_* commands.

comment:2 Changed 5 months ago by rjollos

Just wondering, what is the reason for including *.po and *pot in the package data? Trac does not seem to do the same: trac:browser:/tags/trac-1.0.1/setup.py?marks=83-92#L56

comment:3 Changed 5 months ago by olemis

To declare them as package data . Any other suggestion ?

comment:4 Changed 5 months ago by rjollos

Let me rephrase the question. Why do you think it is necessary to include *.po and *.pot files as package data? I think only the compiled catalogs need to be included, and the setup.py for Trac and Bloodhound would seem to support this.

Last edited 5 months ago by rjollos (previous) (diff)

comment:5 Changed 5 months ago by olemis

It seems I see what you mean now , including .mo files only in bdist packages and .po , .pot only in source tarballs . Is this the case ?

comment:6 Changed 5 months ago by rjollos

I think that is the case, but I'm by no means an expert.

comment:7 Changed 5 months ago by jun66j5

We could remove *.po and *.pot files from the package_data. But the removing leads KeyError: 'themeengine/locale' from resource_filename(__name__, 'locale') if Babel isn't installed.

We should handle a KeyError or check the existence of locale directory using resource_isdir().

  • setup.py

     
    4141                                     'htdocs/farbtastic/*.png', 
    4242                                     'htdocs/farbtastic/*.js', 
    4343                                     'htdocs/farbtastic/*.css', 
    44                                      'locale/*.pot', 
    45                                      'locale/*/LC_MESSAGES/*.po', 
    4644                                     'locale/*/LC_MESSAGES/*.mo'] }, 
    4745    author = 'Noah Kantrowitz', 
    4846    author_email = 'noah@coderanger.net', 
  • themeengine/api.py

     
    107107 
    108108    def __init__(self): 
    109109        import pkg_resources 
    110         locale_dir = pkg_resources.resource_filename(__name__, 'locale') 
    111         add_domain(self.env.path, locale_dir) 
     110        try: 
     111            locale_dir = pkg_resources.resource_filename(__name__, 'locale') 
     112        except KeyError: 
     113            pass 
     114        else: 
     115            add_domain(self.env.path, locale_dir) 
    112116 
    113117        if lazy is None: 
    114118            # Trac < 1.0 : this can safely go in here because the data can 

comment:8 Changed 5 months ago by olemis

I honestly do not like over-complicating the code for this. Initialization code must take for granted the existence of locale folder and setup.py code must ensure that this will be the case .

comment:9 Changed 5 months ago by olemis

In 13789:

ThemeEnginePlugin [ refs #11606 ] Do not copy .po and .pot files in bdist archives
Ensure that locale folder will always be deployed thus avoiding KeyError .

comment:10 Changed 5 months ago by olemis

@jun66j5 please take a look . Other translations are welcome as well .

comment:11 Changed 5 months ago by jun66j5

Looks good to me.

$ rm -f themeengine/locale/*/LC_*/*.mo
$ rm -rf build dist
$ ~/venv/trac/0.12.5-nobabel/bin/python setup.py bdist_egg
...
$ unzip -l dist/TracThemeEngine-2.2.2dev-py2.4.egg | grep locale
      187  03-24-14 00:26   themeengine/locale/README.txt

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.