[drats_users] 0.3.2b6 rpmbuild

Adrian
Sat Nov 14 13:06:54 PST 2009


 I used the RPM file to install 0.3.2b6 on
the other two FC11 systems I have here. So far I have not been able make
it happen using setup.py, which would be easier. 

Thanks for producing the RPMs, I think it's a great thing. Ideally it
would be nice for a Fedora used to be able to do a 'yum update d-rats'
to get the latest version from a yum repository somewhere. That should
make running D-RATS under Linux easier for those who want to give it a
try, but that may not be comfortable with a manual install. 

73,
Mike, N0SO

Ok Mike, Try changing your setup.py to this;


import sys

from d_rats.version import DRATS_VERSION
import os

def win32_build():
    from distutils.core import setup
    import py2exe

    try:
        # if this doesn't work, try import modulefinder
        import py2exe.mf as modulefinder
        import win32com
        for p in win32com.__path__[1:]:
            modulefinder.AddPackagePath("win32com", p)
        for extra in ["win32com.shell"]: #,"win32com.mapi"
            __import__(extra)
            m = sys.modules[extra]
            for p in m.__path__[1:]:
                modulefinder.AddPackagePath(extra, p)
    except ImportError:
        # no build path setup, no worries.
        pass


    opts = {
        "py2exe" : {
            "includes" : "pango,atk,gobject,cairo,pangocairo,win32gui,win32com,win32com.shell,email.iterators,email.generator",
            "compressed" : 1,
            "optimize" : 2,
            "bundle_files" : 3,
            #        "packages" : ""
            }
        }

    setup(
        windows=[{'script' : 'd-rats'},
                 {'script' : 'd-rats_repeater'},
                 {'script' : 'd-rats_mapdownloader'}],
        data_files=["C:\\GTK\\bin\\jpeg62.dll"],
        options=opts)

def macos_build():
    from setuptools import setup
    import shutil

    APP = ['d-rats-%s.py' % DRATS_VERSION]
    shutil.copy("d-rats", APP[0])
    DATA_FILES = [('../Frameworks',
                   ['/opt/local/lib/libpangox-1.0.0.2203.1.dylib']),
                  ('../Resources/pango/1.6.0/modules', ['/opt/local/lib/pango/1.6.0/modules/pango-basic-atsui.so']),
                  ('../Resources',
                   ['images', 'ui']),
                  ]
    OPTIONS = {'argv_emulation': True, "includes" : "gtk,atk,pangocairo,cairo"}

    setup(
        app=APP,
        data_files=DATA_FILES,
        options={'py2app': OPTIONS},
        setup_requires=['py2app'],
        )

def default_build():
    from distutils.core import setup
    from glob import glob

    desktop_files = glob("share/*.desktop")
    form_files = glob("forms/*.x?l")
    image_files = glob("images/*")    
    ui_files = glob("ui/*")
    _locale_files = glob("locale/*/LC_MESSAGES/D-RATS.mo")

    locale_files = []
    for f in _locale_files:
        locale_files.append(("/usr/share/d-rats/%s" % os.path.dirname(f), [f]))

    print "LOC: %s" % str(ui_files)

    setup(
        name="d-rats",
        packages=["d_rats", "d_rats.geopy", "d_rats.ui", "d_rats.sessions"],
        version=DRATS_VERSION,
        scripts=["d-rats", "d-rats_mapdownloader", "d-rats_repeater"],
        data_files=[('/usr/share/applications', desktop_files),             
                    ('/usr/share/d-rats/forms', form_files),
                    ('/usr/share/d-rats/images', image_files),
                    ('/usr/share/d-rats/ui', ui_files),                    
                    ] + locale_files)
                    
if sys.platform == "darwin":
    macos_build()
elif sys.platform == "win32":
    win32_build()
else:
    default_build()



Also add "01" to bdist_rpm.py to patch Fedora python bdist_rpm to match the
distro policy wrt .pyo files as here (find this section in bdist_rpm.py and add) as has been done below;

your path should be;  /usr/lib/python2.6/distutils/command/bdist_rpm.py

section patched below;



('build', 'build_script', def_build),
             ('install', 'install_script',
              ("%s install "
               "-O1 "
               "--root=$RPM_BUILD_ROOT "
               "--record=INSTALLED_FILES") % def_setup_call),
             ('clean', 'clean_script', "rm -rf $RPM_BUILD_ROOT"),



Then running;


python setup.py bdist_rpm --force-arch=i386	--binary-only


That should work for you.


regards

Adrian




More information about the drats_users mailing list