You are not logged in.

#1 2005-03-17 20:09:36

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

Python festival

hello, I've written a bunch of Python programs that may be of interest for you, I'm too lazy/stupid to name them so I just call them "lazy-", here we go...
PKGBUILDs


arch + gentoo + initng + python = enlisy

Offline

#2 2005-03-17 20:49:26

JGC
Developer
Registered: 2003-12-03
Posts: 1,664

Re: Python festival

looks like someone has been lazy tongue

Offline

#3 2005-03-17 21:49:43

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Python festival

wowzers

Offline

#4 2005-03-17 21:56:39

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: Python festival

xerxes2 wrote:

hello, I've written a bunch of Python programs that may be of interest for you, I'm too lazy/stupid to name them so I just call them "lazy-", here we go...

Out of curiosity, why 'lazy-' instead of 'stupid-'? :-D

No wonder you haven't been posting much... too much coding!

Dusty

Offline

#5 2005-03-17 22:30:54

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

Re: Python festival

python festival?

First thing I thought was a bunch of  nerdy programmers sitting around in the woods, talking about why they think python rules, playing music, eating smores, complaining about the poor wireless reception, and making "compile smores" and "make CC=burn -f wood" and other obscure "snake" jokes (silly python people and their love of snakes--almost as bad as silly ruby people and their love of jewelry). wink

turns out it was just xerxes.
:shock:


"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

#6 2005-03-19 01:14:26

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

Re: Python festival

hello again,
you can consider all the code as BSDL license so feel free to do what you want with it,
I've been coding on lazy-pac/libpypac today and added support for "reason" and uninstallations of dependencies,
I just installed gedit and that took in 16 packages and then i hit "remove" and all 16 was taken off,
Now I only need to finish off libpysrc, I'm a little clueless on how to run the PKGBUILD from Python...


arch + gentoo + initng + python = enlisy

Offline

#7 2005-04-26 01:47:12

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

Re: Python festival

this is an old thread,
you can find PKGBUILDs here instead,
http://xerxes2.1go.dk/python/python_sta … ogram.html


arch + gentoo + initng + python = enlisy

Offline

#8 2005-04-26 02:02:52

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

Re: Python festival

xerxes2 wrote:

Now I only need to finish off libpysrc, I'm a little clueless on how to run the PKGBUILD from Python...

Still having trouble? It might be fun to poke around in the code. I think a python implementation of pacman would be cool. I don't think the vm overhead of python would cause too many problems, and it would make testing new features for the C implementation of pacman very easy. A good prototype tool.


"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

#9 2005-04-26 21:58:25

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

Re: Python festival

you can fix libpysrc if you want cactus, it's working pretty nice but it's not a complete clone of makepkg yet, I'm not very fond of bash so makepkg is a little bit messy for me,

also one other thing, I can't find a way to extract "mtime" on the ftp servers for the package databases,

apeiro grabs it through some "ftplib" like "yyyymmddhhmmss" and saves it as .lastupdate so you don't have to sync the mirrors if they havn't been updated since last syncing,

example, "20050425134523" , dunno if that's possible in pythons ftplib,


arch + gentoo + initng + python = enlisy

Offline

#10 2005-04-26 22:11:18

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

Re: Python festival

I think so..

from ftplib import FTP
ftp = FTP('ftp.archlinux.org')   # connect to host, default port
ftp.login()               # user anonymous, passwd anonymous@
ftp.retrlines('modtime %s' % filepath)

or something l like that should work..it would return the time in the following format, I think..

current.db.tar.gz       04/26/2005 16:09:32 GMT

havent tested it, though..
Might need to add a callback to store the string result, or use a different command..like
ftp.sendcmd()


"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

#11 2005-04-26 22:15:20

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Python festival

hooray! string parsing!

Offline

#12 2005-04-26 22:17:20

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

Re: Python festival

if that works cactus I'll be your bitch for a month,  big_smile
I'll be back...

*xerxes starts up vim and starts coding*


arch + gentoo + initng + python = enlisy

Offline

#13 2005-04-26 22:40:34

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Python festival

I'll start my stopwatch... :shock:

Offline

#14 2005-04-26 22:47:51

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

Re: Python festival

I get "unknown command" on that cactus, but I think you'll find it later,

I've been reading the whole ftp standards today but I can't find these little tweaks in there,  sad


arch + gentoo + initng + python = enlisy

Offline

#15 2005-04-26 23:25:44

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

Re: Python festival

bow down and worship me.

from ftplib import FTP
ftp = FTP('ftp.archlinux.org')
ftp.login()
filepath="current/os/i686/"
ftp.cwd(filepath)
timestamp=ftp.sendcmd('MDTM current.db.tar.gz')
print timestamp

All it took was a little ethereal packet sniffing to determine the corrent ftp protocol command to send.
wink

and the output...

(eliott@tungsten temp)$ python2.4 test.py
213 20050426160932

"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

#16 2005-04-27 00:37:26

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

Re: Python festival

you're the new arch network champion cactus!!!!!!!!!!!!!!!!!!!!!!

works like a dream, new versions are uploaded,  8)
I knew you should do it,

it doesn't took that long either, phrak is taking the time isn't he...


arch + gentoo + initng + python = enlisy

Offline

#17 2005-04-27 00:42:47

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

Re: Python festival

xerxes2 wrote:

it doesn't took that long either, phrak is taking the time isn't he...

heh..yeah. I bet he was using a stopwatch, and writing incremental time units on a whiteboard somewhere.  :twisted:


"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

#18 2005-04-27 05:50:57

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

Re: Python festival

xerxes2 wrote:

Now I only need to finish off libpysrc, I'm a little clueless on how to run the PKGBUILD from Python...

If you want to use the bash version of makepkg, and simply have libpysrc be a wrapper for it, I don't think it would be too hard.

Two possibilities I can think of offhand: go to the dir in question, spawn a bash shell, and have it do all the work. Just have libpysrc pass appropriate args, and return std output and error to the python script for display.
The other possibility would be to have lipysrc do it all by hand, basically mimicing the functionality of makepkg, but in python...
It looks like you have started down the road of solution #2, but solution #1 might be easier...

what do you think? I can help with either one if you want...

EDIT: xerxes..I shortened up your exist_check function in libpysrc to 7 lines..10 if you count the comments..


"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

#19 2005-04-27 09:48:20

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

Re: Python festival

woohooo..

this is what I did this evening.. roll

It took me bloody forever to figure out how to read the stdoutput and stderr from a spawned process, without it blocking until all the output was done..silly python.
Finally got it figured out..

The diff is against libpysrc.py-0.1.8. It contains a much shorter find function, and a "passthrough" function.
The passthrough does what its name suggests. It passes through a directory to work in, and a set of flags to makepkg. The output is snagged as soon as it occurs, and simply printed out in this case. It would be easy to send that text somewhere else though...

Here is the magic goodness
Note: I use tabs, so convert tabs to spaces first if you are an evil space user... :twisted:

heh..and here is a screenshotwink
The test script just had the following:

passthrough("/home/build/bwbar","-of")

"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

#20 2005-04-27 10:59:20

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

Re: Python festival

cactus, one goal I had with libpypac/libpysrc was that they should _NOT_ depend on pacman/makepkg,

it should be a complete standalone implementation of ABS,


arch + gentoo + initng + python = enlisy

Offline

#21 2005-04-27 15:21:06

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Python festival

ok, I take very accurate time... I did it all in my head... and according to me, it took cactus:
162 days, 17 hours, 4 minutes, and 39 seconds

Offline

#22 2005-04-27 18:33:50

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

Re: Python festival

xerxes2 wrote:

cactus, one goal I had with libpypac/libpysrc was that they should _NOT_ depend on pacman/makepkg,

it should be a complete standalone implementation of ABS,

I kind of figured. Just remove the passthrough function then. I think the directory find implementation might be useful..

With that in mind, I will see what else I can scratch together to assist in the code.


"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

#23 2005-04-27 19:01:07

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

Re: Python festival

I must admit that it makes sense to pipe makepkg but it should be possible to make a complete clone,

I've fixed a few things in libpysrc-0.1.9 and also added support for building without md5sum, I'll take a look on your patch later tonight, I'm going for a run in the park now so maybe I feel to lazy afterwards,

I've just used lazy-pac to run an update with gcc, glibc and a few other things and then I installed rxvt-unicode from source and everything seems to work so it should be closing in on first stable version 0.2.0  8)


arch + gentoo + initng + python = enlisy

Offline

#24 2005-04-27 19:10:40

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

Re: Python festival

I updated my diff to be against 0.1.9, and removed the passthrough function, even though it was cool and took me a while.. wink

EDIT: It looks like you are just building packages as root. You might want to spawn a subprocess that assumes permissions of a user, and then builds under fakeroot.
Maybe have the user specified in some pypac config file or something...


"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

#25 2005-04-27 21:05:25

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

Re: Python festival

I added your patch cactus, I remember now when I wrote that function that there is probably some better way to do it,
if I understood correctly your function didn't look first in /var/abs/local so I let that stay in the function,
it looks and is much better now! 8)

about this fakeroot stuff I don't have a clue, i'm building as root at the moment and I guess I always used makepkg as root also,
is that not good?


arch + gentoo + initng + python = enlisy

Offline

Board footer

Powered by FluxBB