[Catalog-sig] bytecode non-backcompatibility

Maurice LING mauriceling at acm.org
Thu Apr 28 09:57:22 CEST 2005


Martin v. Löwis wrote:
> Maurice LING wrote:
> 
>>I've emailed to catelog-sig mailing list and is still waiting to hear
>>something. Currently, I have no idea of the structure of PyPI. I hope I
>>can hear from them soon and generate some starting points...
> 
> 
> Posting questions is not the only way to find answers. The source code
> of PyPI is available: sf.net/projects/pypi.
> 
> Regards,
> Martin


I've browsed the source codes of PyPI in sf.net, nothing pops up as very 
useful to me... I reckoned that sitting in here or hoping for replies 
from catelog-sig isn't going to help much.

On that, I've prototyped a very simple proof-of-concept of what I have 
in mind, regarding a Fink-like tool for Python's 3rd party libraries 
management. Please bear in mind that this is a proof-of-concept 
prototype, really bare bones. It can be found in 'centipyde' module in 
sf.net/projects/ib-dwb. In case the CVS hadn't updated by the time 
someone reads this, the directory layout is this:

../centipyde
../centipyde/centipyde.py
../centipyde/pgkinfo
../centipyde/pgkinfo/ply15.info


ply15.info contains the following text (pretty much modelled against Fink):

package=ply15
maintainer=.
dependencies=.
downloadurl=http://systems.cs.uchicago.edu/ply/ply-1.5.tar.gz
prebuildscript=tar zxvf ply-1.5.tar.gz
sourcedir=ply-1.5
buildscript=python setup.py build
installscript=sudo python setup.py install


centipyde.py is the following:
=====================================================

"""
Author: Maurice H.T. Ling <mauriceling at acm.org>
Copyright (c) 2005 Maurice H.T. Ling
Date created : 28th April 2005
"""

PKGINFOPATH = 'pkginfo'
INSTALL_LOG = 'install.log'

import os
import string
import sys

def install_package(package_name):
     f = open(os.getcwd() + os.sep + PKGINFOPATH + os.sep + package_name 
+ '.info', 'r')
     install_info = {}
     for line in f.readlines():
         line = string.split(line, '=')
         if line[1][-1] == os.linesep:
             install_info[line[0]] = string.strip(line[1][:-1])
         else: install_info[line[0]] = string.strip(line[1])
     f.close()
     print "Package Installation Information: " + str(install_info)

     os.system('curl -O ' + str(install_info['downloadurl']))

     preinstall = []
     preinstall = string.split(install_info['prebuildscript'], ';')
     for cmd in preinstall: os.system(cmd)

     cwd = os.getcwd()
     print cwd
     os.chdir(os.path.join(os.getcwd(), install_info['sourcedir']))
     print os.getcwd()

     buildscript = []
     buildscript = string.split(install_info['buildscript'], ';')
     for cmd in buildscript: os.system(cmd)

     installscript = []
     installscript = string.split(install_info['installscript'], ';')
     for cmd in installscript: os.system(cmd)


if sys.argv[1] == 'install':
     install_package(sys.argv[2])

=====================================================

When I run "python centipyde.py install ply15", PLY1.5 gets downloaded 
from David Beazley's website, uncompressed and installed into the 
site-package.

All comments and code donations are welcomed.

Cheers
Maurice


More information about the Catalog-sig mailing list