You are not logged in.

#1 2005-06-28 20:06:08

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

python module loading

hello guys,
i have a very annoying problem with libpypac,

python uses dynamically binary loading and that means that if i should install python with libpypac i'll be in trouble,

scenario:
i run "lazy-pac-cli -S python" and the steps taken by libpypac are,

1. Download the new python version
2. Uninstall the old version
3. Install the new version

you see, when step three comes there is missing stuff that has'nt been used before, i've thought of making o dummypackage or something,


arch + gentoo + initng + python = enlisy

Offline

#2 2005-06-28 23:19:52

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: python module loading

missing stuff?
You might indeed try loading the binaries you need first before doing the uninstall, so they are resident in memory before the step 2.

The other thing you could do is, upon finding out your are going to be updating python, make a temp dir copy of the binaries you need, load them there, then perform the install, then remove the copies and load the new ones.


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#3 2005-06-29 00:18:57

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: python module loading

I always thought that python loaded up everything it needed when you imported things, so as long as enough to get libpypac going is in ram it should work....

Why dont you try it and see what happens? and if it breaks, call pacman in.

Offline

#4 2005-06-29 10:51:15

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: python module loading

@cactus
it should be "stuff missing" i guess,
i want to do it as your first suggestion but i can't figure out how to do it,
a temporary dir sounds like an ugly workaround even if it might work,
how does the real pacman do it with glibc, that should be like the same problem,

@iphitus
i've thought so too but look here what happens:

[root@UFU abs]# ./lazy-pac-cli -S python
The package is already installed in the system.

The following packages will be installed with python:
python-2.4.1-1

Total compressed size: 9.9 MB

Proceed with the installation? [y/n] y
Downloading python ...
... checking md5sum ... done.

Installing python ...
Traceback (most recent call last):
  File "./lazy-pac-cli", line 22, in ?
    main.install_control(sys.argv)
  File "/home/xerxes2/programs/abs/main.py", line 195, in install_control
    install_binary(dep_list, None)
  File "/home/xerxes2/programs/abs/main.py", line 137, in install_binary
    retcode = libpypac.install(package, i, depends_list, noupgrade_list, reason, oldver, None)
  File "/home/xerxes2/programs/abs/libpypac.py", line 584, in install
    tar = tarfile.open(cache_dir + package + ".pkg.tar.gz", "r:gz")
  File "/usr/lib/python2.4/tarfile.py", line 896, in open
  File "/usr/lib/python2.4/tarfile.py", line 948, in gzopen
tarfile.CompressionError: gzip module is not available

hmm, it looks like it is some shared binary missing, "gzip module"


arch + gentoo + initng + python = enlisy

Offline

#5 2005-06-29 11:46:53

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: python module loading

try importing 'gzip' before hand so it's preloaded?

Offline

#6 2005-06-29 11:58:25

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: python module loading

yes, i've found the problem now, it's the "tarfile" module that uses dynamically loading of other python modules it's using,
taken from tarfile.py

def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9):
        """Open gzip compressed tar archive name for reading or writing.
           Appending is not allowed.
        """
        if len(mode) > 1 or mode not in "rw":
            raise ValueError, "mode must be 'r' or 'w'"

        try:
            import gzip
            gzip.GzipFile
        except (ImportError, AttributeError):
            raise CompressionError, "gzip module is not available"

how the hell should i solve this?


arch + gentoo + initng + python = enlisy

Offline

#7 2005-06-29 13:47:17

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: python module loading

iphitus wrote:

try importing 'gzip' before hand so it's preloaded?

yiippppiiiiiiieee!!!!

thanks aussie! that worked, a simple "import gzip" at the top of libpypac solved it,  8)

edit:

[root@UFU abs]# ./lazy-pac-cli -S python
The package is already installed in the system.

The following packages will be installed with python:
python-2.4.1-1

Total compressed size: 9.9 MB

Proceed with the installation? [y/n] y
Using package for python from cache ...
... checking md5sum ... done.

Installing python ...
... done.

The package is installed, enjoy!

arch + gentoo + initng + python = enlisy

Offline

Board footer

Powered by FluxBB