Accessing prefix within setup.py (distutils)

Discussion in 'Python' started by Graham Ashton, Oct 5, 2004.

  1. I'm writing a setup.py script for installing my application and have a
    quick distutils question. My application has a .py file, a
    ..conf file and a .glade file. I would like them to get installed as
    follows:

    /usr/local/bin/myprogram.py
    /usr/local/etc/myprogram.conf
    /usr/local/share/myprogram/glade/myprogram.glade

    This is quite achievable if I specify a prefix of /usr/local, with the
    following:

    setup(...,
    scripts=["myprogram.py"],
    data_files=[("share/myprogram/glade", ["myprogram.glade"]),
    ("etc", ["myprogram.conf"])]
    )

    My question is how to avoid installing myprogram.conf into /usr/etc
    (instead of /etc) if the installer specifies a prefix of /usr? Doesn't
    distutils know the difference between a data file and a config file?

    If I could detect what the --prefix parameter was set to I could deal with
    it myself within setup.py, but I don't seem to be able to get hold of it.

    Thanks in advance.

    -- Graham
    Graham Ashton, Oct 5, 2004
    #1
    1. Advertising

  2. Graham Ashton

    Kirby Angell Guest

    data_files = [ \

    ('/etc/init.d', [ 'scripts/myscript' ] ),
    ('/usr/local/bin', [ 'code/prog1.py' ] ),
    ('/usr/local/bin', [ 'code/prog2.py' ] ),
    ('/usr/local/etc', [ 'etc/prog.conf' ] )

    ]

    works for me to put stuff all over the place. I will confess to not
    having to worry about the --prefix parameter because our software is
    only used in-house.

    > My question is how to avoid installing myprogram.conf into /usr/etc
    > (instead of /etc) if the installer specifies a prefix of /usr? Doesn't
    > distutils know the difference between a data file and a config file?
    >


    --
    Thank you,

    Kirby Angell
    Get notified anytime your website goes down!
    http://www.alertra.com
    key: 9004F4C0
    fingerprint: DD7E E88D 7F50 2A1E 229D 836A DB5B A751 9004 F4C0
    Kirby Angell, Oct 5, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tim Tyler
    Replies:
    36
    Views:
    1,446
    Darryl L. Pierce
    Dec 10, 2004
  2. Holger Joukl
    Replies:
    1
    Views:
    448
    Michael Hudson
    Feb 19, 2004
  3. timw.google
    Replies:
    1
    Views:
    511
    Serge Orlov
    May 11, 2006
  4. Chris  Chiasson
    Replies:
    6
    Views:
    603
    Richard Tobin
    Nov 14, 2006
  5. Luis Alberto Zarrabeitia Gomez

    distutils, No module named numpy.distutils.fcompiler.conv_template

    Luis Alberto Zarrabeitia Gomez, Mar 30, 2009, in forum: Python
    Replies:
    0
    Views:
    1,285
    Luis Alberto Zarrabeitia Gomez
    Mar 30, 2009
Loading...

Share This Page