Re: Updated python-support
Le mardi 20 juin 2006 à 06:47 +0200, Andreas Barth a écrit : > > So it's _no more_ used (it's commented out) but it relies on dpkg-query -L > > instead. > > Which *is* an official interface. And TTBOMK, dpkg is not guaranteed to be reentrant, thus such interfaces shouldn't be used inside maintainer scripts. -- .''`. Josselin Mouette/\./\ : :' : [EMAIL PROTECTED] `. `'[EMAIL PROTECTED] `- Debian GNU/Linux -- The power of freedom
Re: Updated python-support
On Tue, Jun 20, 2006 at 09:05:18AM +0200, Josselin Mouette wrote: > Le mardi 20 juin 2006 à 06:47 +0200, Andreas Barth a écrit : > > > So it's _no more_ used (it's commented out) but it relies on dpkg-query -L > > > instead. > > Which *is* an official interface. > And TTBOMK, dpkg is not guaranteed to be reentrant, thus such interfaces > shouldn't be used inside maintainer scripts. I raised this objection with Matthias, and have been told both that other packages do this sort of thing in practice today, and that the current dpkg maintainers are ok with supporting that interface. -- Steve Langasek Give me a lever long enough and a Free OS Debian Developer to set it on, and I can move the world. [EMAIL PROTECTED] http://www.debian.org/ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Updated dh_python to satisfy everybody
Le mardi 20 juin 2006 à 01:34 +0200, Raphael Hertzog a écrit : > On Mon, 19 Jun 2006, Raphael Hertzog wrote: > > - uses "XS-Python-Standards-Version: 0.4" as reference field to run in > > new > >policy mode. The presence of XS-Python-Version will also trigger the > > new > >policy mode (this is for short-term compatibility, it may be removed > > in > >the not too-distant future). > > Joe proposed on IRC to use "debian/pycompat" instead of a new field. It > sounds very much debhelper-ish and I like it. That's a very good idea indeed. -- .''`. Josselin Mouette/\./\ : :' : [EMAIL PROTECTED] `. `'[EMAIL PROTECTED] `- Debian GNU/Linux -- The power of freedom
Re: Updated dh_python to satisfy everybody
On Tue, 20 Jun 2006, Raphael Hertzog wrote: > On Mon, 19 Jun 2006, Raphael Hertzog wrote: > > - pyversions needs to be modified to not fail if the field > > XS-Python-Version is not present. He should in that case > > use the information of the debian/pyversions file. I will > > hopefully soon provide a patch for this. > > Here's a patch and the resulting pyversions script. For packages not using > XS-Python-Version, they can do "pyversions -r debian/pyversions" and get > the list of python packages to build with. I've slightly updated the patch so that if someone is doing "pyversions -r debian/control" and if it would fail, then it tries "debian/pyversions" before failing. Here's the updated patch and pyversions file. Cheers, -- Raphaël Hertzog Premier livre français sur Debian GNU/Linux : http://www.ouaza.com/livre/admin-debian/ --- /usr/bin/pyversions 2006-06-16 15:00:46.0 +0200 +++ pyversions 2006-06-20 09:10:12.0 +0200 @@ -116,6 +116,36 @@ else: return ['python%s' % v for v in versions] +def version_cmp(ver1,ver2): +v1=[int(i) for i in ver1.split('.')] +v2=[int(i) for i in ver2.split('.')] +return cmp(v1,v2) + +def requested_versions_bis(vstring, version_only=False): +versions = [] +py_supported_short = supported_versions(version_only=True) +for item in vstring.split(','): +v=item.split('-') +if len(v)>1: +if not v[0]: +v[0] = py_supported_short[0] +if not v[1]: +v[1] = py_supported_short[-1] +for ver in py_supported_short: +try: +if version_cmp(ver,v[0]) >= 0 and version_cmp(ver,v[1]) <= 0: +versions.append(ver) +except ValueError: +pass +else: +if v[0] in py_supported_short: +versions.append(v[0]) +versions.sort(version_cmp) +if not version_only: +versions=['python'+i for i in versions] +return versions + + def installed_versions(version_only=False): import glob supported = supported_versions() @@ -192,10 +222,23 @@ elif opts.versions: try: if os.path.isfile(opts.versions): -vs = extract_pyversion_attribute(opts.versions, 'Source') +try: +vs = extract_pyversion_attribute(opts.versions, 'Source') +print ' '.join(requested_versions(vs, opts.version_only)) +except ValueError, msg: +if opts.versions.find("pyversions") != -1: + fn = opts.versions +else: + fn = "debian/pyversions" +if os.path.isfile(fn): +vs = file(fn).readline().rstrip('\n'); +print ' '.join(requested_versions_bis(vs, opts.version_only)) +else: + print "%s: %s" % (program, msg) +raise ValueError, "Couldn't extract XS-Python-Version header from %s and it's not a pyversions file..." % opts.versions else: vs = opts.versions -print ' '.join(requested_versions(vs, opts.version_only)) +print ' '.join(requested_versions(vs, opts.version_only)) except ValueError, msg: print "%s: %s" % (program, msg) sys.exit(1) #! /usr/bin/python import os, re, sys try: SetType = set except NameError: import sets SetType = sets.Set set = sets.Set def parse_versions(vstring): import operator operators = { None: operator.eq, '=': operator.eq, '>=': operator.ge, '<=': operator.le, '<<': operator.lt } vinfo = {} exact_versions = set([]) version_range = set(supported_versions(version_only=True)) relop_seen = False for field in vstring.split(','): field = field.strip() if field == 'all': vinfo['all'] = 'all' continue if field in ('current', 'current_ext'): vinfo['current'] = field continue vinfo.setdefault('versions', set()) ve = re.compile('(>=|<=|<<|=)? *(\d\.\d)$') m = ve.match(field) try: op, v = m.group(1), m.group(2) if op in (None, '='): exact_versions.add(v) else: relop_seen = True filtop = operators[op] version_range = [av for av in version_range if filtop(av ,v)] except Exception: raise ValueError, 'error parsing Python-Version attribute' if 'versions' in vinfo: vinfo['versions'] = exact_versions if relop_seen: vinfo['versions'] = exact_versions.union(version_range) return vinfo _supported_versions = None def supported_versions(version_only=False): global _supported_ver
Re: Updated dh_python to satisfy everybody
On Tue, 20 Jun 2006, Raphael Hertzog wrote: > On Tue, 20 Jun 2006, Raphael Hertzog wrote: > > On Mon, 19 Jun 2006, Raphael Hertzog wrote: > > > - pyversions needs to be modified to not fail if the field > > > XS-Python-Version is not present. He should in that case > > > use the information of the debian/pyversions file. I will > > > hopefully soon provide a patch for this. > > > > Here's a patch and the resulting pyversions script. For packages not using > > XS-Python-Version, they can do "pyversions -r debian/pyversions" and get > > the list of python packages to build with. > > I've slightly updated the patch so that if someone is doing "pyversions -r > debian/control" and if it would fail, then it tries "debian/pyversions" > before failing. Okay yet another update (the last... I promise). Instead of requiring a parameter you can now call "pyversions -r" and in that case it will check first for the field in debian/control and then try with debian/pyversions and if nothing is found, then it will return all the supported versions. Updated files attached. Matthias, this time you can safely integrate this version in the official python package. Cheers, -- Raphaël Hertzog Premier livre français sur Debian GNU/Linux : http://www.ouaza.com/livre/admin-debian/ --- /usr/bin/pyversions 2006-06-16 15:00:46.0 +0200 +++ pyversions 2006-06-20 09:40:55.0 +0200 @@ -116,6 +116,36 @@ else: return ['python%s' % v for v in versions] +def version_cmp(ver1,ver2): +v1=[int(i) for i in ver1.split('.')] +v2=[int(i) for i in ver2.split('.')] +return cmp(v1,v2) + +def requested_versions_bis(vstring, version_only=False): +versions = [] +py_supported_short = supported_versions(version_only=True) +for item in vstring.split(','): +v=item.split('-') +if len(v)>1: +if not v[0]: +v[0] = py_supported_short[0] +if not v[1]: +v[1] = py_supported_short[-1] +for ver in py_supported_short: +try: +if version_cmp(ver,v[0]) >= 0 and version_cmp(ver,v[1]) <= 0: +versions.append(ver) +except ValueError: +pass +else: +if v[0] in py_supported_short: +versions.append(v[0]) +versions.sort(version_cmp) +if not version_only: +versions=['python'+i for i in versions] +return versions + + def installed_versions(version_only=False): import glob supported = supported_versions() @@ -173,7 +203,7 @@ action='store_true', dest='supported') parser.add_option('-r', '--requested', help='print the python versions requested by a build; the argument is either the name of a control file or the value of the XS-Python-Version attribute', - action='store', dest='versions') + action='store_true', dest='requested') parser.add_option('-i', '--installed', help='print the installed supported python versions', action='store_true', dest='installed') @@ -189,13 +219,35 @@ print ' '.join(supported_versions(opts.version_only)) elif opts.installed: print ' '.join(installed_versions(opts.version_only)) -elif opts.versions: +elif opts.requested: try: -if os.path.isfile(opts.versions): -vs = extract_pyversion_attribute(opts.versions, 'Source') +if len(args) >= 1: + # Use parameters to find out the requested version + if os.path.isfile(args[0]): + if args[0].find("pyversions") != -1: + vs = file(args[0]).readline().rstrip('\n'); + print ' '.join(requested_versions_bis(vs, opts.version_only)) + else: + vs = extract_pyversion_attribute(args[0], 'Source') + print ' '.join(requested_versions(vs, opts.version_only)) + else: + print ' '.join(requested_versions(args[0], opts.version_only)) else: -vs = opts.versions -print ' '.join(requested_versions(vs, opts.version_only)) + # Check debian/control and debian/pyversions to find out + # requestd versions + done = 0 + if os.path.isfile("debian/control"): + try: + vs = extract_pyversion_attribute("debian/control", 'Source') + print ' '.join(requested_versions(vs, opts.version_only)) + done = 1 + except: + pass + if not done and os.path.isfile("debian/pyversions"): + vs = file("debian/pyversions").readline().rstrip('\n'); + print ' '.join(requested_versions_bis(v
Re: Orphaning Python packages
On Mon, 2006-06-19 at 20:20 +0200, Carlos Galisteo wrote: > Hello Joe. > > I could be interested about adopting feedparser since I use it in a couple > programs. > > Bad news are that I'm a really new mantainer and could need some initial > help (no problem about looking for a sponsor). > > If you have no problems about that I'll adopt it and start working on it > tonight. The package is orphaned, so if you want it, ITA it. I don't really have to walk someone through the basics of Python packaging though, sorry (especially since it's changing every other hour). The package is not at all complicated. I don't expect it to ever need changes if Python policy stablizes, since it's a single .py file with a distutils script. -- Joe Wreschnig <[EMAIL PROTECTED]> signature.asc Description: This is a digitally signed message part
dh_python using debian/pycompat
Hello everybody, I just updated dh_python to use debian/pycompat (or DH_PYCOMPAT) instead of the Python-Standards-Version field. You can find the updated script and updated debhelper NMU (5.0.37.2) here: http://people.debian.org/~hertzog/python/ Please test it and check it. This versions satisfies me now and I'm most probably going to upload it today and I hope that we can update the pyversions script at the same time. People who do not want to use the XS-Python-Version field do not need to use it, they can use debian/pyversions instead. However dh_python will *always* generate the ${python:Versions} field that can be used to generate XB-Python-Version. And thus the maintainers are free to use it in order to ease the identification of packages that will have to be updated for future python migrations. People who want to use the XS-Python-Version field can use it, and it will be understood correctly by everybody (dh_pysupport/dh_pycentral/dh_python). dh_pysupport and dh_python uses it however as fallback if debian/pyversions doesn't exist. And last, with the udpdated "pyversions" we can tell all maintainers to use "pyversions -rv" to find out the list of python versions that the package should support, whatever they decide to use (XS-P-V or debian/pyversions). I hope everybody can agree to continue in that direction. Cheers, -- Raphaël Hertzog Premier livre français sur Debian GNU/Linux : http://www.ouaza.com/livre/admin-debian/ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]