Relocatable binary installs....

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • friedmud@gmail.com

    #1

    Relocatable binary installs....

    Hello all,

    I'm currently working on a software package that is going to be
    distributed in binary form (with accompanying source) for lot of
    different unixes (Linux, AIX, HP-UX and others). Parts of the package
    are written in Python... so we are going to want to distribute our own
    version of python.

    Right now we are just distributing the Python tarball and building it
    at install time. This works ok, but we are running into some problems
    on some machines with weird default installs (DEC Alphas in
    particular).... some of them won't build all the python modules we want
    (although our in house machines will).

    What I want to do is compile python statically into binaries and then
    plop them wherever our customers choose to do an install (we will
    provide the source tarballs on a cd as well). The problem we are
    running into is that when we do this python continues to think it's
    still installed where it was initially compiled and not where it has
    been placed (which causes some problems with traceback and some other
    functions).

    Is there a way to make a relocateable python binary... that is... a
    python installation that won't care where it is on the machine... and
    won't care if it gets put somewhere else besides / ?

    Sorry for the long winded post... just want to make sure you understand
    my problem.

    Thanks in advance for any help!

    Derek

  • Fredrik Lundh

    #2
    Re: Relocatable binary installs....

    friedmud@gmail. com wrote:
    [color=blue]
    > Is there a way to make a relocateable python binary... that is... a
    > python installation that won't care where it is on the machine... and
    > won't care if it gets put somewhere else besides / ?[/color]

    the standard CPython interpreter is 100% "relocatabl e". If you think
    it isn't, you have to be a bit more specific.

    </F>



    Comment

    • Steve Holden

      #3
      Re: Relocatable binary installs....

      Fredrik Lundh wrote:
      [color=blue]
      > friedmud@gmail. com wrote:
      >
      >[color=green]
      >>Is there a way to make a relocateable python binary... that is... a
      >>python installation that won't care where it is on the machine... and
      >>won't care if it gets put somewhere else besides / ?[/color]
      >
      >
      > the standard CPython interpreter is 100% "relocatabl e". If you think
      > it isn't, you have to be a bit more specific.
      >[/color]
      Is it possible that you are using "relocatabl e" in the standard sense of
      "code can be located anywhere in physical memory", where the OP is using
      the same term to mean "can live anywhere in the filestore"?

      I suspect the problem the OP is seeing is because the --prefix
      configuration parameter will cause an interpreter to look in a specific
      place for standard libraries. Clearly if you "relocate" the libraries to
      another directory entirely then an interpreter without any further nouse
      (and no symbolic links to help it) is going to crap out badly.

      But I could be wrong.

      always-prepared-to-at-least-admit-the-possibility-ly y'rs - steve
      --
      Steve Holden http://www.holdenweb.com/
      Python Web Programming http://pydish.holdenweb.com/
      Holden Web LLC +1 703 861 4237 +1 800 494 3119

      Comment

      • Steve Holden

        #4
        Re: Relocatable binary installs....

        Fredrik Lundh wrote:
        [color=blue]
        > friedmud@gmail. com wrote:
        >
        >[color=green]
        >>Is there a way to make a relocateable python binary... that is... a
        >>python installation that won't care where it is on the machine... and
        >>won't care if it gets put somewhere else besides / ?[/color]
        >
        >
        > the standard CPython interpreter is 100% "relocatabl e". If you think
        > it isn't, you have to be a bit more specific.
        >[/color]
        Is it possible that you are using "relocatabl e" in the standard sense of
        "code can be located anywhere in physical memory", where the OP is using
        the same term to mean "can live anywhere in the filestore"?

        I suspect the problem the OP is seeing is because the --prefix
        configuration parameter will cause an interpreter to look in a specific
        place for standard libraries. Clearly if you "relocate" the libraries to
        another directory entirely then an interpreter without any further nouse
        (and no symbolic links to help it) is going to crap out badly.

        But I could be wrong.

        always-prepared-to-at-least-admit-the-possibility-ly y'rs - steve
        --
        Steve Holden http://www.holdenweb.com/
        Python Web Programming http://pydish.holdenweb.com/
        Holden Web LLC +1 703 861 4237 +1 800 494 3119

        Comment

        • Fredrik Lundh

          #5
          Re: Relocatable binary installs....

          Steve Holden wrote:
          [color=blue][color=green][color=darkred]
          >>>Is there a way to make a relocateable python binary... that is... a
          >>>python installation that won't care where it is on the machine... and
          >>>won't care if it gets put somewhere else besides / ?[/color]
          >>
          >>
          >> the standard CPython interpreter is 100% "relocatabl e". If you think
          >> it isn't, you have to be a bit more specific.
          >>[/color]
          > Is it possible that you are using "relocatabl e" in the standard sense of "code can be located
          > anywhere in physical memory", where the OP is using the same term to mean "can live anywhere in
          > the filestore"?[/color]

          nope.
          [color=blue]
          > I suspect the problem the OP is seeing is because the --prefix configuration parameter will cause
          > an interpreter to look in a specific place for standard libraries. Clearly if you "relocate" the
          > libraries to another directory entirely then an interpreter without any further nouse (and no
          > symbolic links to help it) is going to crap out badly.[/color]

          clearly?

          [fredrik@brain build] mv python2.3 /tmp
          [fredrik@brain build] mkdir /tmp/lib
          [fredrik@brain build] mv lib /tmp/lib/python2.3
          [fredrik@brain build] cd /tmp
          [fredrik@brain tmp]$ ./python2.3[color=blue][color=green][color=darkred]
          >>> import sys
          >>> sys.prefix[/color][/color][/color]
          '/tmp'[color=blue][color=green][color=darkred]
          >>> sys.path[/color][/color][/color]
          ['', '/tmp/lib/python23.zip', '/tmp/lib/python2.3', ...][color=blue][color=green][color=darkred]
          >>>[/color][/color][/color]
          [fredrik@brain tmp]$ mkdir spam
          [fredrik@brain tmp]$ mv python2.3 spam
          [fredrik@brain tmp]$ mv lib spam
          [fredrik@brain tmp]$ cd spam/
          [fredrik@brain spam]$ ./python2.3[color=blue][color=green][color=darkred]
          >>> import sys
          >>> sys.prefix[/color][/color][/color]
          '/tmp/spam'[color=blue][color=green][color=darkred]
          >>> sys.path[/color][/color][/color]
          ['', '/tmp/spam/lib/python23.zip', '/tmp/spam/lib/python2.3', ...][color=blue][color=green][color=darkred]
          >>>[/color][/color][/color]

          [fredrik@brain spam]$ mkdir bin
          [fredrik@brain spam]$ mv python2.3 bin
          [fredrik@brain spam]$ bin/python2.3[color=blue][color=green][color=darkred]
          >>> import sys
          >>> sys.prefix[/color][/color][/color]
          '/tmp/spam'[color=blue][color=green][color=darkred]
          >>>[/color][/color][/color]

          [fredrik@brain spam]$ cd bin
          [fredrik@brain bin]$ ./python2.3[color=blue][color=green][color=darkred]
          >>> import sys
          >>> sys.prefix[/color][/color][/color]
          '/tmp/spam'

          [fredrik@brain fredrik]$ export PATH=/tmp/spam/bin:$PATH
          [fredrik@brain bin]$ cd
          [fredrik@brain fredrik]$ python2.3[color=blue][color=green][color=darkred]
          >>> import sys
          >>> sys.prefix[/color][/color][/color]
          '/tmp/spam'[color=blue][color=green][color=darkred]
          >>>[/color][/color][/color]

          and so on...

          </F>



          Comment

          • Steve Holden

            #6
            Re: Relocatable binary installs....

            Fredrik Lundh wrote:[color=blue]
            > Steve Holden wrote:
            >
            >[color=green][color=darkred]
            >>>>Is there a way to make a relocateable python binary... that is... a
            >>>>python installation that won't care where it is on the machine... and
            >>>>won't care if it gets put somewhere else besides / ?
            >>>
            >>>
            >>>the standard CPython interpreter is 100% "relocatabl e". If you think
            >>>it isn't, you have to be a bit more specific.
            >>>[/color]
            >>
            >>Is it possible that you are using "relocatabl e" in the standard sense of "code can be located
            >>anywhere in physical memory", where the OP is using the same term to mean "can live anywhere in
            >>the filestore"?[/color]
            >
            >
            > nope.
            >
            >[color=green]
            >>I suspect the problem the OP is seeing is because the --prefix configuration parameter will cause
            >>an interpreter to look in a specific place for standard libraries. Clearly if you "relocate" the
            >>libraries to another directory entirely then an interpreter without any further nouse (and no
            >>symbolic links to help it) is going to crap out badly.[/color]
            >
            >
            > clearly?
            >
            > [fredrik@brain build] mv python2.3 /tmp
            > [fredrik@brain build] mkdir /tmp/lib
            > [fredrik@brain build] mv lib /tmp/lib/python2.3
            > [fredrik@brain build] cd /tmp
            > [fredrik@brain tmp]$ ./python2.3
            >[color=green][color=darkred]
            >>>>import sys
            >>>>sys.prefi x[/color][/color]
            >
            > '/tmp'
            >[color=green][color=darkred]
            >>>>sys.path[/color][/color]
            >
            > ['', '/tmp/lib/python23.zip', '/tmp/lib/python2.3', ...]
            >
            > [fredrik@brain tmp]$ mkdir spam
            > [fredrik@brain tmp]$ mv python2.3 spam
            > [fredrik@brain tmp]$ mv lib spam
            > [fredrik@brain tmp]$ cd spam/
            > [fredrik@brain spam]$ ./python2.3
            >[color=green][color=darkred]
            >>>>import sys
            >>>>sys.prefi x[/color][/color]
            >
            > '/tmp/spam'
            >[color=green][color=darkred]
            >>>>sys.path[/color][/color]
            >
            > ['', '/tmp/spam/lib/python23.zip', '/tmp/spam/lib/python2.3', ...]
            >
            >
            > [fredrik@brain spam]$ mkdir bin
            > [fredrik@brain spam]$ mv python2.3 bin
            > [fredrik@brain spam]$ bin/python2.3
            >[color=green][color=darkred]
            >>>>import sys
            >>>>sys.prefi x[/color][/color]
            >
            > '/tmp/spam'
            >
            >
            > [fredrik@brain spam]$ cd bin
            > [fredrik@brain bin]$ ./python2.3
            >[color=green][color=darkred]
            >>>>import sys
            >>>>sys.prefi x[/color][/color]
            >
            > '/tmp/spam'
            >
            > [fredrik@brain fredrik]$ export PATH=/tmp/spam/bin:$PATH
            > [fredrik@brain bin]$ cd
            > [fredrik@brain fredrik]$ python2.3
            >[color=green][color=darkred]
            >>>>import sys
            >>>>sys.prefi x[/color][/color]
            >
            > '/tmp/spam'
            >
            >
            > and so on...
            >[/color]
            Well, OK, maybe it's not quite as clear as I thought :-)

            regards
            Steve
            --
            Steve Holden http://www.holdenweb.com/
            Python Web Programming http://pydish.holdenweb.com/
            Holden Web LLC +1 703 861 4237 +1 800 494 3119

            Comment

            • Steve Holden

              #7
              Re: Relocatable binary installs....

              Fredrik Lundh wrote:[color=blue]
              > Steve Holden wrote:
              >
              >[color=green][color=darkred]
              >>>>Is there a way to make a relocateable python binary... that is... a
              >>>>python installation that won't care where it is on the machine... and
              >>>>won't care if it gets put somewhere else besides / ?
              >>>
              >>>
              >>>the standard CPython interpreter is 100% "relocatabl e". If you think
              >>>it isn't, you have to be a bit more specific.
              >>>[/color]
              >>
              >>Is it possible that you are using "relocatabl e" in the standard sense of "code can be located
              >>anywhere in physical memory", where the OP is using the same term to mean "can live anywhere in
              >>the filestore"?[/color]
              >
              >
              > nope.
              >
              >[color=green]
              >>I suspect the problem the OP is seeing is because the --prefix configuration parameter will cause
              >>an interpreter to look in a specific place for standard libraries. Clearly if you "relocate" the
              >>libraries to another directory entirely then an interpreter without any further nouse (and no
              >>symbolic links to help it) is going to crap out badly.[/color]
              >
              >
              > clearly?
              >
              > [fredrik@brain build] mv python2.3 /tmp
              > [fredrik@brain build] mkdir /tmp/lib
              > [fredrik@brain build] mv lib /tmp/lib/python2.3
              > [fredrik@brain build] cd /tmp
              > [fredrik@brain tmp]$ ./python2.3
              >[color=green][color=darkred]
              >>>>import sys
              >>>>sys.prefi x[/color][/color]
              >
              > '/tmp'
              >[color=green][color=darkred]
              >>>>sys.path[/color][/color]
              >
              > ['', '/tmp/lib/python23.zip', '/tmp/lib/python2.3', ...]
              >
              > [fredrik@brain tmp]$ mkdir spam
              > [fredrik@brain tmp]$ mv python2.3 spam
              > [fredrik@brain tmp]$ mv lib spam
              > [fredrik@brain tmp]$ cd spam/
              > [fredrik@brain spam]$ ./python2.3
              >[color=green][color=darkred]
              >>>>import sys
              >>>>sys.prefi x[/color][/color]
              >
              > '/tmp/spam'
              >[color=green][color=darkred]
              >>>>sys.path[/color][/color]
              >
              > ['', '/tmp/spam/lib/python23.zip', '/tmp/spam/lib/python2.3', ...]
              >
              >
              > [fredrik@brain spam]$ mkdir bin
              > [fredrik@brain spam]$ mv python2.3 bin
              > [fredrik@brain spam]$ bin/python2.3
              >[color=green][color=darkred]
              >>>>import sys
              >>>>sys.prefi x[/color][/color]
              >
              > '/tmp/spam'
              >
              >
              > [fredrik@brain spam]$ cd bin
              > [fredrik@brain bin]$ ./python2.3
              >[color=green][color=darkred]
              >>>>import sys
              >>>>sys.prefi x[/color][/color]
              >
              > '/tmp/spam'
              >
              > [fredrik@brain fredrik]$ export PATH=/tmp/spam/bin:$PATH
              > [fredrik@brain bin]$ cd
              > [fredrik@brain fredrik]$ python2.3
              >[color=green][color=darkred]
              >>>>import sys
              >>>>sys.prefi x[/color][/color]
              >
              > '/tmp/spam'
              >
              >
              > and so on...
              >[/color]
              Well, OK, maybe it's not quite as clear as I thought :-)

              regards
              Steve
              --
              Steve Holden http://www.holdenweb.com/
              Python Web Programming http://pydish.holdenweb.com/
              Holden Web LLC +1 703 861 4237 +1 800 494 3119

              Comment

              Working...