/[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 12964 - (show annotations) (download) (as text)
Tue May 5 17:01:39 2009 UTC (4 years, 1 month ago) by joss
File MIME type: text/x-python
File size: 1667 byte(s)
* update-python-modules:
  + Don't do anything when called with -c for public modules. This 
    will allow modules to remain available while being upgraded.
  + Don't byte-compile public modules when called without -p, either. 
    This should reduce the time consumed during upgrades.
  + Support a new --post-install/-p option, that byte-compiles public 
    modules and removes any dangling symbolic links left by a package 
    removal or upgrade.
  + Indentation fixes.
* triggers: register triggers on /usr/share/python-support and 
  /usr/lib/python-support.
* postinst:
  + Always byte-compile python-support.dirs.
  + Launch update-python-support --post-install to enforce 
    byte-compilation.
  + Launch only this command when triggered.
* control: build-depend on debhelper 5.0.59 for triggers support.
* pysupport.py: deprecate python2.3.
* control: depend on python >= 2.4 to match the change.
1 import os
2
3 # Do not get the version list from pyversions, it isn't reliable
4 py_supported = ['python2.4','python2.5']
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:
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 self.pylist=['python'+i for i in self.verlist]
49 def __iter__(self):
50 return iter(self.pylist)
51 def __contains__(self,item):
52 return item in self.pylist

  ViewVC Help
Powered by ViewVC 1.1.5