You are not logged in.
Hi, im doing a little script in python to help me to compile software from source.
But i got stucked. My script uncompress the packages, but, how can i make that python move to the new directory so it can build it?
How can i detect the name of the new directory?
Last edited by B4RR13N705 (2009-08-24 21:39:12)
OS -----> Arch Linux DE -----> KDE4
CPU ---> 2.66GHz RAM ---> 512 MB
SWAP -> 2 G / -------> 10 G
/home -> 50 G /boot ---> 64 MB
Offline
well you could just diff the current dir,
import os
start = os.listdir()
# Unpack
new = os.listdir()
folder = None
for name in new:
if not name in start:
folder = name
break
Offline
os.chdir(dir) changes the directory :-)
os.popen("ls -t1 --group-directories-first | head -n 1").read().strip()
gives the most recently created directory
Edit: removed "-C" option from ls which is useless
Last edited by kowalski (2009-08-24 21:39:51)
He who says A doesn't have to say B. He can also recognize that A was false.
Offline
Thanx!
OS -----> Arch Linux DE -----> KDE4
CPU ---> 2.66GHz RAM ---> 512 MB
SWAP -> 2 G / -------> 10 G
/home -> 50 G /boot ---> 64 MB
Offline
Why not using the shell for a shell-job?
Offline
Say again?
Offline
Say again?
Hi, im doing a little script in python to help me to compile software from source.
I know that it is easy to perform the wanted task from shell, but if he would like to write a script, for say, a self-extracting program/installer, this could be pretty useful.
Last edited by Paaskehare (2009-08-25 10:02:49)
→ im.ole
Offline
I know that it is easy to perform the wanted task from shell, but if he would like to write a script, for say, a self-extracting program/installer, this could be pretty useful.
Im going crazy with this , im writing about 200 codelines "for now"..
Im extending my task and writing a complete package manager... For now, it has the ability of downloading packages from net, which contains especial META files, then unpack it in a temporaly dir, compile and install it. It also handles a little database.
The 'script' detects automatically all dependencies left, download and install them..., and you can patch the software by automatically donwloading this patch and apply auto-patch right before installing it!
Im surprised...
Last edited by B4RR13N705 (2009-08-25 16:33:39)
OS -----> Arch Linux DE -----> KDE4
CPU ---> 2.66GHz RAM ---> 512 MB
SWAP -> 2 G / -------> 10 G
/home -> 50 G /boot ---> 64 MB
Offline