/[collab-maint]/deb-maint/python-support/trunk/pysupport.py
ViewVC logotype

Contents of /deb-maint/python-support/trunk/pysupport.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 12980 - (show annotations) (download) (as text)
Tue May 5 17:06:55 2009 UTC (4 years, 1 month ago) by joss
File MIME type: text/x-python
File size: 1581 byte(s)
* Major changes to the installed packages format. The old format is 
  still supported at runtime, but will not be generated anymore.
* Private modules now ship foo.private files, containing the metadata 
  and file listing for the package.
* Public modules now ship foo.public files for metadata and listing, 
  and files go to /usr/{share,lib}/pyshared. Closes: #478178.
* The modules installation path was changed to /usr/lib/pymodules.
* The private directory has moved to 
  /usr/share/python-support/private. The specific scripts are now 
  installed in here.
* Important documentation updates.
* copyright: point to the correct LGPL location.
* Add support for python2.6.
1 import os
2
3 # Do not get the version list from pyversions, it isn't reliable
4 py_supported = ['python2.4','python2.5','python2.6']
5 py_installed = [ ver for ver in py_supported if os.access('/usr/bin/'+ver,os.X_OK) ]
6 py_supported_short = [ a.replace("python","") for a in py_supported ]
7 py_oldversions = ['python2.1','python2.2','python2.3']
8
9 def version_cmp(ver1,ver2):
10 v1=[int(i) for i in ver1.split('.')]
11 v2=[int(i) for i in ver2.split('.')]
12 return cmp(v1,v2)
13
14 # Parse the version format from .version files
15 class version_list(list):
16 def __init__(self,version_info):
17 self.verlist=[]
18 dummylist=[]
19 for item in version_info.rstrip('\n').split(','):
20 v=[i.strip() for i in item.split('-')]
21 if len(v)>1:
22 if v[0]:
23 dummylist.append(v[0])
24 else:
25 v[0] = py_supported_short[0]
26 dummylist.append("0")
27 if v[1]:
28 dummylist.append(v[1])
29 else:
30 v[1] = py_supported_short[-1]
31 dummylist.append("100")
32 for ver in py_supported_short:
33 try:
34 if version_cmp(ver,v[0]) >= 0 and version_cmp(ver,v[1]) <= 0:
35 self.verlist.append(ver)
36 except ValueError:
37 pass
38 else:
39 dummylist.append(v[0])
40 if v[0] in py_supported_short:
41 self.verlist.append(v[0])
42 self.verlist.sort(version_cmp)
43 dummylist.sort(version_cmp)
44 self.min=dummylist[0]
45 if self.min=="0": self.min=None
46 self.max=dummylist[-1]
47 if self.max=="100": self.max=None
48 for i in self.verlist:
49 self.append('python'+i)
50

  ViewVC Help
Powered by ViewVC 1.1.5