Skip to content
Snippets Groups Projects
Commit 38758ae2 authored by Matthias Klose's avatar Matthias Klose
Browse files

package version python-defaults-2.3.5-6

parent 08fff94d
No related branches found
No related tags found
No related merge requests found
python-defaults (2.3.5-6) unstable; urgency=low
* Last 2.3.5 upload, 2.4.3 can be found in experimental.
* Do not build the python-mpz, python-tk and python-gdbm packages from
this source.
* Let the -all packages depend on the default packages (closes: #365219).
* Add /usr/share/python/debian_defaults for some default values (i.e.
the supported python versions).
* Add /etc/python/debian_config for byte-compilation options.
* Add a pyversions script to give information about python versions and
parse the XS-Python-Version attribute.
* Do not build the python-doc package from this source.
-- Matthias Klose <doko@debian.org> Sun, 11 Jun 2006 23:42:42 +0200
python-defaults (2.3.5-5) unstable; urgency=low
* Fix upgrade issues (closes: #348319, #348354).
......
......@@ -24,11 +24,8 @@ Description: An interactive high-level object-oriented language (default version
Package: python-minimal
Architecture: all
Essential: yes
Priority: required
Priority: standard
Depends: python2.3 (>= 2.3.5-1)
Conflicts: python (<< 2.3.5-4)
Replaces: python (<< 2.3.5-4)
Description: A minimal subset of the Python language (default version)
This package contains the interpreter and some essential modules. It's used
in the boot process for some basic tasks.
......@@ -38,36 +35,6 @@ Description: A minimal subset of the Python language (default version)
NOTE: There is no python2.3-minimal package yet, this package will depend
on the python2.4-minimal package after a change of default python version.
Package: python-tk
Architecture: all
Depends: python (>= 2.3), python (<< 2.4), python2.3-tk (>= 2.3.5-1)
Description: Tkinter - Writing Tk applications with Python (default version)
A module for writing portable GUI applications with Python sing Tk.
Also known as Tkinter.
.
This package is a dependency package, which depends on Debian's default
Python version (currently v2.3).
Package: python-gdbm
Architecture: all
Depends: python (>= 2.3), python (<< 2.4), python2.3-gdbm (>= 2.3.5-1)
Description: GNU dbm database support for Python (default version)
GNU dbm database module for Python. Install this if you want to
create or read GNU dbm database files with Python.
.
This package is a dependency package, which depends on Debian's default
Python version (currently v2.3).
Package: python-mpz
Architecture: all
Depends: python (>= 2.3), python (<< 2.4), python2.3-mpz (>= 2.3.5-1)
Description: Multiple-precision arithmetic support for Python (default version)
Arbitrary precision arithmetic for Python using the GNU MP
library, i.e. bignum support.
.
This package is a dependency package, which depends on Debian's default
Python version (currently v2.3).
Package: python-examples
Architecture: all
Depends: python (>= 2.3), python (<< 2.4), python2.3-examples (>= 2.3.5-1)
......@@ -139,7 +106,7 @@ Description: Debug Build of the Python Interpreter (version 2.3)
Package: python-all
Architecture: all
Priority: optional
Depends: python2.3, python2.4
Depends: python-all (>= 2.3), python2.3, python2.4
Description: Package depending on all supported Python runtime versions
The package currently depends on python2.3 and python2.4, in the future,
dependencies on jython (Python for a JVM) and ironpython (Python for Mono)
......@@ -151,7 +118,7 @@ Description: Package depending on all supported Python runtime versions
Package: python-all-dev
Architecture: all
Priority: optional
Depends: python-all (>= 2.3), python2.3-dev, python2.4-dev
Depends: python-all (>= 2.3), python-dev, python2.3-dev, python2.4-dev
Description: Package depending on all supported Python development packages
The package currently depends on python2.3-dev and python2.4-dev, in the
future, dependencies on jython (Python for a JVM) and ironpython (Python
......
......@@ -35,36 +35,6 @@ Description: A minimal subset of the Python language (default version)
NOTE: There is no python2.3-minimal package yet, this package will depend
on the python2.4-minimal package after a change of default python version.
Package: python-tk
Architecture: all
Depends: python (>= @VER@), python (<< @NVER@), @PVER@-tk (>= @PREVVER@)
Description: Tkinter - Writing Tk applications with Python (default version)
A module for writing portable GUI applications with Python sing Tk.
Also known as Tkinter.
.
This package is a dependency package, which depends on Debian's default
Python version (currently v@VER@).
Package: python-gdbm
Architecture: all
Depends: python (>= @VER@), python (<< @NVER@), @PVER@-gdbm (>= @PREVVER@)
Description: GNU dbm database support for Python (default version)
GNU dbm database module for Python. Install this if you want to
create or read GNU dbm database files with Python.
.
This package is a dependency package, which depends on Debian's default
Python version (currently v@VER@).
Package: python-mpz
Architecture: all
Depends: python (>= @VER@), python (<< @NVER@), @PVER@-mpz (>= @PREVVER@)
Description: Multiple-precision arithmetic support for Python (default version)
Arbitrary precision arithmetic for Python using the GNU MP
library, i.e. bignum support.
.
This package is a dependency package, which depends on Debian's default
Python version (currently v@VER@).
Package: python-examples
Architecture: all
Depends: python (>= @VER@), python (<< @NVER@), @PVER@-examples (>= @PREVVER@)
......@@ -136,7 +106,7 @@ Description: Debug Build of the Python Interpreter (version @VER@)
Package: python-all
Architecture: all
Priority: optional
Depends: python2.3, python2.4
Depends: python-all (>= @VER@), python2.3, python2.4
Description: Package depending on all supported Python runtime versions
The package currently depends on python2.3 and python2.4, in the future,
dependencies on jython (Python for a JVM) and ironpython (Python for Mono)
......@@ -148,7 +118,7 @@ Description: Package depending on all supported Python runtime versions
Package: python-all-dev
Architecture: all
Priority: optional
Depends: python-all (>= @VER@), python2.3-dev, python2.4-dev
Depends: python-all (>= @VER@), python-dev, python2.3-dev, python2.4-dev
Description: Package depending on all supported Python development packages
The package currently depends on python2.3-dev and python2.4-dev, in the
future, dependencies on jython (Python for a JVM) and ironpython (Python
......
[DEFAULT]
default-version = python2.3
supported-versions = python2.3, python2.4
#! /bin/sh -e
new_config_file()
{
cat > /etc/python/debian_config <<-EOF
[DEFAULT]
# how to byte-compile (comma separated: standard, optimize)
byte-compile = standard
EOF
}
case "$1" in
configure)
[ -d /etc/python ] || mkdir /etc/python
[ -f /etc/python/debian_config ] || new_config_file
esac
#DEBHELPER#
#! /bin/sh -e
case "$1" in
purge)
rm -rf /etc/python
esac
#DEBHELPER#
#! /bin/sh -e
case "$1" in
remove)
rm -f /usr/share/python/pyversions.py[co]
esac
#DEBHELPER#
#! /usr/bin/python
import sys
sys.path[0:0] = ['/usr/share/python']
import pyversions
pyversions.main()
.TH PYVERSIONS
.SH NAME
pyversions \- print python version information
.SH SYNOPSIS
.PP
.B pyversions
.I [-h] [-v] [<options>]
.SH DESCRIPTION
.PP
.B pyversions
prints information about installed, supported python runtimes, the
default runtime, and parses the information of the PythonVersion
fields in the package control file.
.SH OPTIONS
.TP
.I -d, --default
Show the default python version.
.TP
.I -s, --supported
Show the supported python versions.
.TP
.I -r, --requested <version string> | <control file>
Reads the
.B XS-Python-Version
value in the source section of a control file and shows all
matching python versions. The parameter is interpreted as
a version string, if it is not the name of a file.
.TP
.I -i, --installed
Show the installed supported python versions.
.TP
.I -v, --version
Limit the output to the version numbers of the python versions.
.TP
.I -h, --help
Print a help text.
.SH SEE ALSO
Python policy.
.SH AUTHOR
Matthias Klose
#! /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_versions
if not _supported_versions:
if os.path.exists('/usr/share/python/debian_defaults'):
import ConfigParser
config = ConfigParser.SafeConfigParser()
config.read('/usr/share/python/debian_defaults')
value = config.get('DEFAULT', 'supported-versions')
_supported_versions = [s.strip() for s in value.split(',')]
else:
cmd = ['/usr/bin/apt-cache', '--no-all-versions',
'show', 'python-all']
try:
import subprocess
p = subprocess.Popen(cmd, bufsize=1,
shell=False, stdout=subprocess.PIPE)
fd = p.stdout
except ImportError:
fd = os.popen(' '.join(cmd))
depends = None
for line in fd:
if line.startswith('Depends:'):
depends = line.split(':', 1)[1].strip().split(',')
fd.close()
depends = [re.sub(r'\s*(\S+)[ (]?.*', r'\1', s) for s in depends]
_supported_versions = depends
if version_only:
return [v[6:] for v in _supported_versions]
else:
return _supported_versions
_default_version = None
def default_version(version_only=False):
global _default_version
if not _default_version:
_default_version = link = os.readlink('/usr/bin/python')
if version_only:
return _default_version[6:]
else:
return _default_version
def requested_versions(vstring, version_only=False):
versions = None
vinfo = parse_versions(vstring)
supported = supported_versions(version_only=True)
if len(vinfo) == 1:
vkey = vinfo[vinfo.keys()[0]]
if 'all' in vinfo:
versions = supported
elif 'current' in vinfo:
versions = [default_version()]
else:
versions = vinfo['versions'].intersection(supported)
elif 'all' in vinfo and 'current' in vinfo:
raise ValueError, "both `current' and `all' in version string"
elif 'all' in vinfo:
versions = versions = vinfo['versions'].intersection(supported)
elif 'current' in vinfo:
current = default_version(version_only=True)
if not current in vinfo['versions']:
raise ValueError, "`current' version not in supported versions"
versions = [current]
else:
raise ValueError, 'error in version string'
if not versions:
raise ValueError, 'empty set of versions'
if version_only:
return versions
else:
return ['python%s' % v for v in versions]
def installed_versions(version_only=False):
import glob
versions = [os.path.basename(s)
for s in glob.glob('/usr/bin/python[0-9].[0-9]')]
versions.sort()
if version_only:
return [v[6:] for v in versions]
else:
return versions
def extract_pyversion_attribute(fn, pkg):
"""read the debian/control file, extract the XS-Python-Version
field; check that XB-Python-Version exists for the package."""
version = None
sversion = None
section = None
for line in file(fn):
line = line.strip()
if line == '':
section = None
elif line.startswith('Source:'):
section = 'Source'
elif line.startswith('Package: ' + pkg):
section = self.name
elif line.startswith('XS-Python-Version:'):
if section != 'Source':
raise ValueError, \
'attribute XS-Python-Version not in Source section'
sversion = line.split(':', 1)[1].strip()
elif line.startswith('XB-Python-Version:'):
if section == pkg:
version = line.split(':', 1)[1].strip()
if pkg == 'Source':
if sversion == None:
raise ValueError, 'missing XS-Python-Version in control file'
return sversion
if version == None:
raise ValueError, \
'missing XB-Python-Version for package `%s' % pkg
return version
def main():
from optparse import OptionParser
usage = '[-v] [-h] [-d|--default] [-s|--supported] [-i|--installed] [-r|--requested <version string>|<control file>]'
parser = OptionParser(usage=usage)
parser.add_option('-d', '--default',
help='print the default python version',
action='store_true', dest='default')
parser.add_option('-s', '--supported',
help='print the supported python versions',
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')
parser.add_option('-i', '--installed',
help='print the installed supported python versions',
action='store_true', dest='installed')
parser.add_option('-v', '--version',
help='print just the version number(s)',
default=False, action='store_true', dest='version_only')
opts, args = parser.parse_args()
program = os.path.basename(sys.argv[0])
if opts.default:
print default_version(opts.version_only)
elif opts.supported:
print ' '.join(supported_versions(opts.version_only))
elif opts.installed:
print ' '.join(installed_versions(opts.version_only))
elif opts.versions:
try:
if os.path.isfile(opts.versions):
vs = extract_pyversion_attribute(opts.versions, 'Source')
else:
vs = opts.versions
print ' '.join(requested_versions(vs, opts.version_only))
except ValueError, msg:
print "%s: %s" % (program, msg)
sys.exit(1)
else:
print "usage: %s %s" % (program, usage)
sys.exit(1)
if __name__ == '__main__':
main()
......@@ -25,6 +25,9 @@ scriptdir = usr/lib/python$(VER)
rst2html = $(PVER) /usr/share/python-docutils/rst2html.py
with_doc = no
NOPKGS = -Npython-doc
build: stamp-build
stamp-build:
touch stamp-build
......@@ -142,6 +145,18 @@ binary-indep: build install stamp-doc
ln -sf pdb$(VER).1.gz \
debian/python/usr/share/man/man1/pdb.1.gz
: #
mkdir -p debian/python/usr/share/python
cp -p debian/debian_defaults \
debian/python/usr/share/python/
cp -p debian/pyversions.py \
debian/python/usr/share/python/
install -m 755 debian/pyversions \
debian/python/usr/bin/
cp -p debian/pyversions.1 \
debian/python/usr/share/man/man1/
mkdir -p debian/python/usr/share/doc/python
cp -a debian/python-policy.{html,sgml,txt} \
debian/python/usr/share/doc/python/
......@@ -153,9 +168,11 @@ binary-indep: build install stamp-doc
debian/python/usr/share/doc/python$(VER)/python-policy.$$ext; \
done
ifeq ($(with_doc),yes)
mkdir -p debian/python-doc/usr/share/doc/python
ln -sf ../python$(VER)-doc/html \
debian/python-doc/usr/share/doc/python/html
endif
mkdir -p debian/python/usr/share/apps/konsole
cp -p debian/python.desktop debian/python/usr/share/apps/konsole/
......@@ -179,21 +196,18 @@ binary-indep: build install stamp-doc
ln -sf idle-python$(VER).1.gz \
debian/idle/usr/share/man/man1/idle.1.gz
mkdir -p debian/python-tk/usr/share/doc/python-tk
cp -p debian/README.Tk debian/python-tk/usr/share/doc/python-tk/
# dh_installdebconf -i
dh_installdocs -i --all debian/README.Debian
dh_installmenu -i
dh_installchangelogs -i
# dh_installdebconf -i $(NOPKGS)
dh_installdocs -i $(NOPKGS) --all debian/README.Debian
dh_installmenu -i $(NOPKGS)
dh_installchangelogs -i $(NOPKGS)
# rm -rf debian/python-all-dev/usr/share/doc/python-all-dev
# ln -sf python$(VER)-all debian/python-all-dev/usr/share/doc/python-all-dev
dh_compress -i
dh_fixperms -i
dh_installdeb -i
dh_gencontrol -i
dh_md5sums -i
dh_builddeb -i
dh_compress -i $(NOPKGS)
dh_fixperms -i $(NOPKGS)
dh_installdeb -i $(NOPKGS)
dh_gencontrol -i $(NOPKGS)
dh_md5sums -i $(NOPKGS)
dh_builddeb -i $(NOPKGS)
# Build architecture-dependent files here.
binary-arch: build install
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment