Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 02 May 2004 20:27:55 -0500
From:      Jeremy Messenger <mezz7@cox.net>
To:        freebsd-python@FreeBSD.org
Subject:   Is it bug in Straw or Python?
Message-ID:  <opr7eg0tql8ckrg5@smtp.central.cox.net>

next in thread | raw e-mail | index | archive | help
------------dQ7JwHHj4NK63YMnimGNpu
Content-Type: text/plain; format=flowed; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

Hello,

I am sure, some of you might remember that net/straw has hit on Python bug 
sometime ago. So, I am not sure if it's Straw or Python bug. The update 
version (0.23, not in ports tree yet) of Straw will complain:

=======================================
creating /var/tmp/straw/etc/gconf/schemas
copying data/straw.schemas -> /var/tmp/straw/etc/gconf/schemas
running install_gconf
error: Interrupted system call
*** Error code 1
=======================================

It complains with and without '-c -O1' in PYDISTUTILS_INSTALLARGS. So, I 
created a workaround for now like this:

=======================================
-      msg_sources      = translation_files(),
+      msg_sources      = ['glade/strings.c'] + glob.glob('src/lib/*.py'),
=======================================

It solves problem, since this is what has in the old version of Straw. 
Here's what translation_files() that was added looks like in setup.py:

=======================================
def translation_files():
     '''Files for translation...'''
     potfile = './po/POTFILES.in'

     if not os.path.exists(potfile):
         sys.exit("No such file, '%s'. Please file a bug report.." % 
potfile)

     f = open(potfile)
     files = []

     for line in f:
         # ignore comments and newline
         if line.startswith('#') or line.startswith('\n'):
             continue
         else: files.append(line.strip())

     f.close()
     return files
=======================================

Attaching setup.py here in case if anyone want the full of it.

P.S. CC me, I am not on this list. Thanks!

Cheers,
Mezz


-- 
mezz7@cox.net  -  mezz@FreeBSD.org
bsdforums.org 's moderator, mezz.
------------dQ7JwHHj4NK63YMnimGNpu
Content-Disposition: attachment; filename=setup.py
Content-Type: text/plain; name=setup.py
Content-Transfer-Encoding: 8bit

#! /usr/bin/env python
#
# setup.py for Straw
#
# 

import imp
import sys
import glob
import os.path

from tools.straw_distutils import setup

name = 'straw'
version = '0.23'

# Check for Python < 2.2
if sys.version < '2.2':
    sys.exit('Error: Python-2.2 or newer is required. Current version:\n %s'
             % sys.version)

def modules_check():
    '''Check if necessary modules is installed.
    The function is executed by distutils (by the install command).'''
    try:
        import pygtk
        pygtk.require('2.0')
        imp.find_module('gtk')
    except:
        sys.exit('Error: PyGTK-1.99.13 or newer is required.')

    mod_list = [
        ('ORBit', 'pyorbit', 0),
        ('gnome', 'gnome-python', 0),
        ('gnome.vfs', "gnome-python's gnomevfs", 0),
        ('gtkhtml2', "gnome-python's gtkhtml2", 1),
        ('gconf', "gnome-python's gconf", 0)]

    if sys.version < '2.3':
        mod_list.append(('bsddb3.db', 'bsddb3', 0))

    ok = 1
    for m, w, x in mod_list:
        try:
            if not x:
                exec('import %s' % m)
            else:
                imp.find_module(m)
        except ImportError:
            ok = False
            print 'Error: %s Python module is required to install %s' \
                  % (w, name.title())
    try:
        import adns, ADNS
    except ImportError:
        print 'Warning: adns Python module not found, will continue without.'

    # gtk.glade needs special care (ugly...)
    if ok:
        path = imp.find_module('gtk')
        if not os.path.exists(path[1] + '/glade.so'):
            ok = False
            print 'Error: %s Python module is required to install %s' \
                  % ("PyGTK's glade", name.title())
    if not ok:
        sys.exit(1)

def translations():
    '''Build mo-po mapping from po directory'''
    trans = []
    dest = 'share/locale/%s/LC_MESSAGES/%s.mo'
    for po in glob.glob('po/*.po'):
        lang = os.path.splitext(os.path.basename(po))[0]
        trans.append((dest % (lang , name), po))
    return trans

def translation_files():
    '''Files for translation...'''
    potfile = './po/POTFILES.in'

    if not os.path.exists(potfile):
        sys.exit("No such file, '%s'. Please file a bug report.." % potfile)

    f = open(potfile)
    files = []

    for line in f:
        # ignore comments and newline
        if line.startswith('#') or line.startswith('\n'):
            continue
        else: files.append(line.strip())

    f.close()
    return files

def data_files():
    '''Build list of data files to be installed'''
    images = glob.glob('images/*.png')
    files = [
        ('share/pixmaps', ['images/straw.png']),
        ('share/straw', images + ['data/default_subscriptions.opml', 'glade/straw.glade'])]
    return files

long_desc = '''\
Straw is a desktop news aggregator for the GNOME environment.
Its aim is to be a faster, easier and more accessible way to read
news and blogs than the traditional browser.'''

# Let distutils do the work
setup(name             = name,
      version          = version,
      description      = 'Desktop news aggregator for GNOME',
      long_description = long_desc,
      author           = 'Juri Pakaste',
      author_email     = 'juri@iki.fi',
      url              = 'http://www.nongnu.org/straw/',
      license          = 'GPL',
      data_files       = data_files(),
      pot_file         = 'po/straw.pot',
      translations     = translations(),
      config_files     = [('gconf/schemas',['data/straw.schemas'],
                           'with-gconf-schema-file-dir')],
      scripts          = ['src/straw'],
      modules_check    = modules_check,
      packages         = ['straw'],
      package_dir      = {'straw' : 'src/lib'},
      msg_sources      = translation_files(),
      desktop_file     = ['straw.desktop.in'])


------------dQ7JwHHj4NK63YMnimGNpu--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?opr7eg0tql8ckrg5>