Modify

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#11606 closed defect (fixed)

Cannot install ThemeEnginePlugin 2.2.2 cause of "running compile_catalog_js"

Reported by: Jun Omae Owned by: Olemis Lang
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 3 years ago by Olemis Lang

Resolution: fixed
Status: newclosed

In 13718:

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

... formerly breaking bdist_* commands.

comment:2 Changed 3 years ago by Ryan J Ollos

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 3 years ago by Olemis Lang

To declare them as package data . Any other suggestion ?

comment:4 Changed 3 years ago by Ryan J Ollos

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 3 years ago by Ryan J Ollos (previous) (diff)

comment:5 Changed 3 years ago by Olemis Lang

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 3 years ago by Ryan J Ollos

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

comment:7 Changed 3 years ago by Jun Omae

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 3 years ago by Olemis Lang

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 3 years ago by Olemis Lang

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 3 years ago by Olemis Lang

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

comment:11 Changed 3 years ago by Jun Omae

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

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Olemis Lang.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.