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

dh_python2: create symlinks for files installed into /usr/share/pyshared/

if there are no other public modules available
parent bd06b1d0
No related branches found
No related tags found
No related merge requests found
python-defaults (2.6.6-6) UNRELEASED; urgency=low
* Make the error message about missing extension more clear
(and more verbose in --verbose mode)
* dh_python2: install files listed in debian/pkg.pyinstall file
as public modules for all requested Python versions (use dh_install's
package.install files for private modules); remove public modules listed
in debian/pkg.pyremove (glob.glob pattern and version range can be used in
both files)
* dh_python2:
- make the error message about missing extension more clear
(and more verbose in --verbose mode)
- install files listed in debian/pkg.pyinstall file
as public modules for all requested Python versions (use dh_install's
package.install files for private modules)
- remove public modules listed in debian/pkg.pyremove (glob.glob pattern
and version range can be used in both .pyinstall and .pyremove files)
- create symlinks for files installed into /usr/share/pyshared/ if there
are no other public modules available
* pycompile:
- `pycompile $DESTDIR/usr/lib/python*` will recognize public
site-packages directories and use the right interpreter instead of
raising KeyError
- do not try to check if interpreter is present when version range is
empty (closes: 605356)
empty
-- Piotr Ożarowski <piotr@debian.org> Sun, 21 Nov 2010 23:49:32 +0100
......
......@@ -205,6 +205,24 @@ def create_ext_links(dir1):
relative_symlink(fpath1, join(dstdir, i))
def create_public_links(dir1, vrange, root=''):
"""Create public module symlinks for given directory."""
debian, package, path = dir1.split('/', 2)
versions = get_requested_versions(vrange)
for fn in os.listdir(dir1):
fpath1 = join(dir1, fn)
if isdir(fpath1):
create_public_links(fpath1, vrange, join(root, fn))
else:
for version in versions:
dstdir = join(sitedir(version, package), root)
if not exists(dstdir):
os.makedirs(dstdir)
relative_symlink(fpath1, join(dstdir, fn))
def share_2x(dir1, dir2, dc=None):
"""Move common files to pyshared and create symlinks in original
locations."""
......@@ -281,6 +299,7 @@ def scan(package, dname=None):
('usr/lib/%s', 'usr/lib/games/%s',
'usr/share/%s', 'usr/share/games/%s')]
else:
# scan private directory *only*
proot = join('debian', package, dname.strip('/'))
private_to_check = [dname[1:]]
......@@ -484,13 +503,18 @@ def main():
options.arch is True and pdetails['arch'] == 'all':
continue
log.debug('processing package %s...', package)
if not pyinstall(package, options.vrange):
exit(4)
if not pyremove(package, options.vrange):
exit(5)
fix_locations(package)
if not private_dir:
if not pyinstall(package, options.vrange):
exit(4)
if not pyremove(package, options.vrange):
exit(5)
fix_locations(package)
stats = scan(package, private_dir)
share(package, stats, options)
if not private_dir:
share(package, stats, options)
pyshared_dir = "debian/%s/usr/share/pyshared/" % package
if not stats['public_vers'] and exists(pyshared_dir):
create_public_links(pyshared_dir, options.vrange)
dependencies = Dependencies(package,
dh.packages[package]['uses_breaks'])
......@@ -524,7 +548,7 @@ def main():
ext_for = details.get('public_ext')
if ext_for is None: # no extension
if options.vrange:
if options.vrange and options.vrange != (None, None):
args += " -V %s" % vrange_str(options.vrange)
elif ext_for is False: # extension's version not detected
if options.vrange and '-' not in vrange_str(options.vrange):
......
#!/usr/bin/make -f
# enable or disable tests here:
TESTS := test1
TESTS := test1 test2
all: $(TESTS)
......
#!/usr/bin/make -f
all: run check
run: clean
dpkg-buildpackage -b -us -uc
check:
test -f debian/python-foo/usr/lib/python2.6/dist-packages/foo.py
test -f debian/python-foo/usr/lib/python2.6/dist-packages/bar/bar.py
clean:
./debian/rules clean
print("I'm __init__.py")
print("I'm bar")
foo (0.1.1) unstable; urgency=low
* Initial release
-- Piotr Ożarowski <piotr@debian.org> Sat, 27 Feb 2010 20:42:17 +0100
7
Source: foo
Section: python
Priority: optional
Maintainer: Piotr Ożarowski <piotr@debian.org>
Build-Depends: debhelper (>= 7.0.50~)
Build-Depends-Indep: python-all
Standards-Version: 3.9.1
XS-Python-Version: >= 2.1
Package: python-foo
Architecture: all
Depends: ${python:Depends}, ${misc:Depends}
Recommends: ${python:Recommends}
Suggests: ${python:Suggests}
Enhances: ${python:Enhances}
Breaks: ${python:Breaks}
Description: foo to rule them all
exemple package #2
The Debian packaging is © 2010, Piotr Ożarowski <piotr@debian.org> and
is licensed under the MIT License.
foo.py /usr/share/pyshared/
__init__.py /usr/share/pyshared/bar/
bar.py /usr/share/pyshared/bar/
#!/usr/bin/make -f
%:
dh $@ --buildsystem=python_distutils
override_dh_pysupport:
DH_VERBOSE=1 ../../dh_python2
clean:
dh_clean
3.0 (native)
print("I'm foo")
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