[Distutils] Metadata.

Vincenzo Di Massa hawk78_it at yahoo.it
Sun Aug 14 22:58:02 CEST 2005


Hi,
Thank you Phillip for your help and support!

I would like to access a package metadata before  it is installed:

I use the following class

####################CLASS
class Easy_deb:
    def __init__(self,req_string):
        self.requirement    = pkg_resources.Requirement.parse(req_string)
        self.index          = PackageIndex()
        self.found          = None
        self.dest           = None
        self.filename       = None
        self.source_dir     = None
        
    def download_source(self):
        self.index.find_packages(self.requirement)
        self.found=self.index.obtain(self.requirement)
        if self.found:
            self.dest='deb-pkg-'+self.found.key+self.found.version
        if os.path.isdir(self.dest):
            shutil.rmtree(self.dest)
        os.makedirs(self.dest)
        self.filename=self.index.download(self.found.location, self.dest)

    def unpack(self):
        unpack_archive(self.filename, self.dest)
        setups = glob.glob(os.path.join(self.dest, '*', 'setup.py'))
        self.source_dir = os.path.dirname(setups[0])

    def deb_src(self):
        debian_dir=os.path.join(self.source_dir,'debian')
        shutil.copytree('template',debian_dir)
        #file=os.path.join(debian_dir,"control")
        #print file
        sed(os.path.join(debian_dir,"control"),"%%PKGNAME%%",self.requirement.key)  <------ SED LINE
        os.chdir(self.source_dir)
        
        #inst_dir=os.path.join('./debian','tmp')
        #main(['-d']+[inst_dir,'.'])
            
    def create(self):
        self.download_source()
        self.unpack()
        self.deb_src()
####################END OF CLASS

to download modules and create a deb package.
I need to retrieve other metadata like description, author and license.
I nned it to put it into lines like SED LINE.

Thank you again
Vincenzo

	

	
		
___________________________________ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it


More information about the Distutils-SIG mailing list