Skip to content
Snippets Groups Projects
Commit 07ad8204 authored by Piotr Ożarowski's avatar Piotr Ożarowski
Browse files

dh_python2: add dist_fallback file

(with a list of Python distribution name and Debian package name pairs (to be
used as a fall back source for PyDist feature))
parent 496a04cd
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ PREFIX ?= /usr/local
clean:
make -C tests clean
make -C pydist clean
find . -name '*.py[co]' -delete
rm -f .coverage
......@@ -25,6 +26,9 @@ install-runtime:
install: install-dev install-runtime
dist_fallback:
make -C pydist $@
nose:
nosetests --with-doctest --with-coverage
......
python-defaults (2.6.6-2) UNRELEASED; urgency=low
* Add README.derivatives (source package)
* dh_python2:
- add dist_fallback file with a list of Python distribution name and
Debian package name pairs (to be used as a fall back source for
PyDist feature)
- TODO: disable PyDist feature if dh_pydeb is in debian/rules
-- Piotr Ożarowski <piotr@debian.org> Thu, 02 Sep 2010 19:18:26 +0200
python-defaults (2.6.6-1) unstable; urgency=low
[ Piotr Ożarowski ]
......
README.PyDist*
pydist/README.PyDist*
......@@ -46,7 +46,7 @@ stamp-doc-policy:
debiandoc2html debian/python-policy.sgml
rm -rf debian/python-policy.html
mv -f python-policy.html debian/
rst2html README.PyDist README.PyDist.html
make -C pydist README.PyDist.html
touch stamp-doc-policy
stamp-doc: stamp-doc-policy
......@@ -105,7 +105,7 @@ clean: control-file
done
rm -f debian/*.py[co]
make clean
dh_clean README.PyDist.html
dh_clean
stamp-control:
: # We have to prepare the various control files
......@@ -126,6 +126,7 @@ stamp-install: stamp-build control-file stamp-control
dh_testdir
dh_testroot
dh_installdirs usr/share/doc/python/faq
dh_install
set -e; \
cd faq && \
......@@ -149,6 +150,9 @@ stamp-dh_python:
make check_versions
DESTDIR=debian/python PREFIX=/usr make install-dev
DESTDIR=debian/python-minimal PREFIX=/usr make install-runtime
# disabled by default, run manually if you want to update it
# (requires apt-file and network connection)
#make -C pydist dist_fallback
touch $@
# Build architecture-independent files here.
......
......@@ -72,7 +72,8 @@ def validate(fpath, exit_on_error=False):
@memoize
def load(dname='/usr/share/python/dist/', fname='debian/pydist-overrides'):
def load(dname='/usr/share/python/dist/', fname='debian/pydist-overrides',
fbname='/usr/share/python/dist_fallback'):
"""Load iformation about installed Python distributions."""
if exists(fname):
to_check = [fname] # first one!
......@@ -80,6 +81,8 @@ def load(dname='/usr/share/python/dist/', fname='debian/pydist-overrides'):
to_check = []
if isdir(dname):
to_check.extend(join(dname, i) for i in os.listdir(dname))
if exists(fbname): # fall back generated at python-defaults build time
to_check.append(fbname) # last one!
result = {}
for fpath in to_check:
......
#!/usr/bin/make -f
clean:
rm -rf cache
#rm -f dist_fallback
rm -f README.PyDist.html
dist_fallback:
python ./generate_fallback_list.py
README.PyDist.html:
rst2html README.PyDist README.PyDist.html
.PHONY: clean
File moved
This diff is collapsed.
#! /usr/bin/python
# -*- coding: UTF-8 -*-
# Copyright © 2010 Piotr Ożarowski <piotr@debian.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
import os
import sys
from subprocess import Popen, PIPE
if not os.path.isdir('cache'):
process = Popen('apt-file -s sources.list -c cache update', shell=True)
process.communicate()
if process.returncode != 0:
sys.stderr.write('Cannot download APT data files')
exit(1)
# find .egg-info files/directories
process = Popen('apt-file -s sources.list -c cache find -x '
'"/usr/((share/pyshared)|(lib/python2\.[0-9]/((site)|(dist))-packages))/[^/]*\.egg-info"',
shell=True, stdout=PIPE)
stdout, stderr = process.communicate()
if process.returncode != 0:
sys.stderr.write('Cannot find packages with Egg metadata')
exit(2)
processed = set()
result = []
for line in stdout.splitlines():
pname, path = line.split(': ', 1)
if pname == 'python-setuptools':
continue
egg_name = [i.split('-', 1)[0] for i in path.split('/')\
if i.endswith('.egg-info')][0]
if egg_name.endswith('.egg'):
egg_name = egg_name[:-4]
if egg_name not in processed:
processed.add(egg_name)
result.append("%s %s\n" % (egg_name, pname))
#result.append("%s %s\t%s\n" % (egg_name, pname, path))
result.sort()
fp = open('dist_fallback', 'w')
fp.write('setuptools python-pkg-resources\n')
fp.writelines(result)
deb http://ftp.debian.org/debian/ unstable main
deb-src http://ftp.debian.org/debian/ unstable main
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