2 """Straw: A feed aggregator for open source desktops.
4 Straw is a feed aggregator for open source desktops. Its goal is to be a
5 faster, easier, and more accessible way to read news and blogs than the
6 web browser. It uses the Python bindings to the GTK+ toolkit and supports RSS
11 Development Status :: 4 - Beta
12 Environment :: X11 Applications :: GTK
13 Environment :: X11 Applications :: Gnome
14 Intended Audience :: End Users/Desktop
15 License :: OSI Approved :: GNU General Public License (GPL)
16 Operating System :: POSIX
17 Operating System :: POSIX :: Linux
18 Programming Language :: Python
19 Topic :: Desktop Environment
20 Topic :: Desktop Environment :: Gnome
21 Topic :: Internet :: WWW/HTTP
28 strawenv
= {'APPNAME': 'Straw',
29 'VERSION': '0.28-dev',
33 if sys
.version
< strawenv
['PYTHON']:
34 sys
.exit('Error: %s or newer is required. Current version:\n %s'
35 % (strawenv
['PYTHON'],sys
.version
))
37 doclines
= __doc__
.split("\n")
40 '''Check if necessary modules is installed.
41 The function is executed by distutils (by the install command).'''
42 # Set This For Machines with No DISPLAY
46 # Check for PyGTK version
50 imp
.find_module('gtk')
52 if gtk
.pygtk_version
< strawenv
['PYGTK']:
54 except AssertionError:
55 pass # We ignore this because gtk must be present to build"
56 except RuntimeError, msg
:
57 if os
.environ
.get ('DISPLAY', '') != '':
58 etype
, value
, tb
= sys
.exc_info ()
59 traceback
.print_exception (etype
, value
, tb
)
61 sys
.exit('Error: unexpected runtime error checking for gtk module')
63 pass # No DISPLAY set, pass
65 sys
.exit('Error: PyGTK-%d.%d.%d or newer is required.' % strawenv
['PYGTK'])
67 # Check other module requirements.
68 # In pygtk versions prior to 2.10, gtkhtml2 is included in
69 # the 'gnome' module. But as of 2.10, the gtkhtml2 module was
70 # removed in 'gnome' and added in 'gnome-extras' module.
71 # The egg.trayicon module is also included in g-p-e, so no need to check here.
73 ('gnome', 'python-gnome2', 0),
74 ('gtkhtml2', "python-gnome2-extras", 0),
75 ('gconf', "python-gnome2", 1),
76 ('bsddb.db', 'python-bsddb', 0),
77 ('dbus', 'python-dbus', 0)]
79 for m
, w
, x
in mod_list
:
80 if nogtk
== 1 and m
== 'gtkhtml2':
84 if not x
: exec('import %s' % m
)
85 else: imp
.find_module(m
)
86 except ImportError, msg
:
87 sys
.exit("Error: '%s' module in package '%s' is required to install %s" \
88 % (m
,w
,strawenv
['APPNAME']))
90 # Check for dbus version
91 if getattr(dbus
, 'version', None) is None:
92 print "Warning: Recent versions of DBus is needed to run Straw"
94 # gtk.glade needs special care (ugly...)
95 path
= imp
.find_module('gtk')
96 if not os
.path
.exists(path
[1] + '/glade.so'):
97 sys
.exit('Error: %s module is required to install %s' \
98 % ("PyGTK's glade", strawenv
['APPNAME']))
104 print 'Warning: ADNS Python module not found, will continue without.'
107 '''Build mo-po mapping from po directory'''
109 dest
= 'share/locale/%s/LC_MESSAGES/%s.mo'
110 for po
in glob
.glob('po/*.po'):
111 lang
= os
.path
.splitext(os
.path
.basename(po
))[0]
112 trans
.append((dest
% (lang
, strawenv
['APPNAME'].lower()), po
))
115 def translation_files():
116 '''Files for translation...'''
117 potfile
= './po/POTFILES.in'
118 if not os
.path
.exists(potfile
):
119 sys
.exit("No such file, '%s'. This file should've been built \
120 automatically. You can run \"intltool-update --pot\" to create it manually.\
121 We also encourage you to file a bug report against Straw." % potfile
)
126 # ignore comments and newline
127 if not line
.startswith('#') or not line
.startswith('\n'):
128 files
.append(line
.strip())
134 '''Build list of data files to be installed'''
135 images
= glob
.glob('images/*.png')
137 'data/default_subscriptions.opml',
142 ('share/pixmaps', ['images/straw.png']),
143 ('share/straw', images
+ misc
)]
146 # Let distutils do the work
147 from tools
.straw_distutils
import setup
148 setup(name
= strawenv
['APPNAME'],
149 version
= strawenv
['VERSION'],
150 description
= doclines
[0],
151 long_description
= "\n".join(doclines
[2:]),
152 author
= 'Juri Pakaste',
153 author_email
= 'juri@iki.fi',
154 maintainer
= 'Jan Alonzo',
155 maintainer_email
= 'jmalonzo@unpluggable.com',
156 url
= 'http://www.gnome.org/projects/straw/',
158 data_files
= data_files(),
159 pot_file
= 'po/straw.pot',
160 translations
= translations(),
161 modules_check
= modules_check
,
162 msg_sources
= translation_files(),
163 desktop_file
= ['straw.desktop.in'],
164 constants
= [('constants.py.in', strawenv
)],
165 scripts
= ['src/straw'],
166 packages
= ['straw'],
167 package_dir
= {'straw' : 'src/lib'},
168 config_files
= [('gconf/schemas',['data/straw.schemas'],
169 'with-gconf-schema-file-dir')],
170 classifiers
= filter(None, classifiers
.split("\n")))