Menu

#15 Full setup.py install script

open
nobody
Packaging (4)
5
2009-02-17
2009-02-17
llaumgui
No

Hi,

I package grnotify for Fedora and I propose to you a new setup.py :
#/usr/bin/python
"""Copyright (C) 2009 Kristof Bamps

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from distutils.core import setup
from os import path
import sys

BIN_DIR = path.join('usr', 'bin')
DATA_DIR = path.join('usr', 'share')
PIXMAPS_DIR = path.join(DATA_DIR , 'pixmaps')
APP_DIR = path.join(DATA_DIR , 'applications')
check = True

# 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)

for arg in sys.argv:
if arg == '--nocheck':
check = False

if check:
try:
import gtk.glade
import egg.trayicon
import pygtk
pygtk.require("2.0")
import gobject
import pynotify
import dbus
import dbus.service
import dbus.mainloop.glib
from xml.sax import make_parser
from xml.sax.handler import ContentHandler
except ImportError, error:
exit (error)

setup(
name='grnotify',
version='1.1.0',
author='Kristof Bamps',
author_email='bamps DOT kristof AT gmail.com',
url='https://sourceforge.net/projects/grnotify/',
license='GPLv2+',
description='A Google Reader in python',
platforms='Any',
packages=['grnotify'],
package_dir={'grnotify': 'src/grnotify'},
scripts = ['scripts/grnotify'],
data_files=[
(PIXMAPS_DIR + "/grnotify",
['pixmaps/broken.gif', 'pixmaps/new.gif', 'pixmaps/nonew.gif']),
(PIXMAPS_DIR,
['pixmaps/grnotify.xpm']),
(DATA_DIR + "/grnotify",
['share/about.glade', 'share/config.glade', 'share/feed.glade']),
(APP_DIR,
['share/grnotify.desktop'])
]
)

For install :
python setup.py install -O1 --root ./test

This install script imposes a new sources organisation :
- grnotify move in scripts
- GoogleReader.py mouve in a package called grnotify in src
- in grnotify replace import GoogleReader by from grnotify import GoogleReader

I joins a new version of sources

++

Discussion

  • llaumgui

    llaumgui - 2009-02-17
     
  • llaumgui

    llaumgui - 2009-02-18

    A another exemple without modification off src :
    #/usr/bin/python
    """Copyright (C) 2009 Kristof Bamps

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program. If not, see <http://www.gnu.org/licenses/>.
    """
    from distutils.core import setup
    from os import path
    import sys

    DATA_DIR = path.join('share')
    PIXMAPS_DIR = path.join(DATA_DIR , 'pixmaps')
    APP_DIR = path.join(DATA_DIR , 'applications')

    setup(
    name='grnotify',
    version='1.1.2',
    author='Kristof Bamps',
    author_email='bamps DOT kristof AT gmail.com',
    url='https://sourceforge.net/projects/grnotify/',
    license='GPLv2+',
    description='A Google Reader in python',
    platforms='Any',
    py_modules=['GoogleReader'],
    scripts=['grnotify'],
    data_files=[
    (PIXMAPS_DIR + "/grnotify",
    ['pixmaps/broken.gif', 'pixmaps/new.gif', 'pixmaps/nonew.gif']),
    (PIXMAPS_DIR,
    ['pixmaps/grnotify.xpm']),
    (DATA_DIR + "/grnotify",
    ['share/about.glade', 'share/config.glade', 'share/feed.glade']),
    (APP_DIR,
    ['share/grnotify.desktop'])
    ]
    )

     

Log in to post a comment.

Auth0 Logo