diff -Nru python3-defaults-3.2.3/autoscripts/postinst-py3compile python3-defaults-3.4.0/autoscripts/postinst-py3compile --- python3-defaults-3.2.3/autoscripts/postinst-py3compile 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/autoscripts/postinst-py3compile 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -if which py3compile >/dev/null 2>&1; then - py3compile -p #PACKAGE# #ARGS# -fi diff -Nru python3-defaults-3.2.3/autoscripts/prerm-py3clean python3-defaults-3.4.0/autoscripts/prerm-py3clean --- python3-defaults-3.2.3/autoscripts/prerm-py3clean 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/autoscripts/prerm-py3clean 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -if which py3clean >/dev/null 2>&1; then - py3clean -p #PACKAGE# #ARGS# -fi diff -Nru python3-defaults-3.2.3/debian/changelog python3-defaults-3.4.0/debian/changelog --- python3-defaults-3.2.3/debian/changelog 2012-04-15 05:07:32.000000000 +0000 +++ python3-defaults-3.4.0/debian/changelog 2015-07-16 00:03:30.000000000 +0000 @@ -1,15 +1,396 @@ -python3-defaults (3.2.3-0ubuntu1) precise; urgency=low +python3-defaults (3.4.0-0ubuntu2ols1) precise; urgency=low - * Update version number to match python3.2 for precise release + * Precise backport. - -- Scott Kitterman Sun, 15 Apr 2012 00:42:45 -0400 + -- Caio Begotti Wed, 15 Jul 2015 21:03:26 -0300 -python3-defaults (3.2.3~rc1-2ubuntu1) precise; urgency=low +python3-defaults (3.4.0-0ubuntu2) trusty; urgency=medium - * Add idle3 Breaks as well as Replaces python3 (thanks to Jakub Wilk for - pointing this out) + * debpython/version.py: Remove 3.3 as supported version. - -- Scott Kitterman Thu, 22 Mar 2012 17:08:22 -0400 + -- Matthias Klose Sun, 23 Mar 2014 09:14:21 +0100 + +python3-defaults (3.4.0-0ubuntu1) trusty; urgency=medium + + * Bump version to 3.4.0. + * Drop 3.3 as a supported python3 version. LP: #1295153. + + -- Matthias Klose Sun, 23 Mar 2014 08:52:38 +0100 + +python3-defaults (3.4~rc1-1) experimental; urgency=medium + + * Default to python3.4. + + -- Matthias Klose Wed, 12 Feb 2014 13:03:28 +0100 + +python3-defaults (3.3.4-1) unstable; urgency=medium + + * Bump version to 3.3.4. + + -- Matthias Klose Wed, 12 Feb 2014 11:15:40 +0100 + +python3-defaults (3.3.3-1) experimental; urgency=low + + * Add python3.4 as a supported python version. + + -- Matthias Klose Thu, 26 Dec 2013 00:39:55 +0100 + +python3-defaults (3.3.2-17) unstable; urgency=low + + * Add Multi-Arch: allowed for python3-all-dev. + + -- Matthias Klose Wed, 18 Sep 2013 15:46:08 +0200 + +python3-defaults (3.3.2-16) unstable; urgency=low + + * Restore :any relationship for python3-minimal build-dep now that it is + supported on the buildds + + -- Scott Kitterman Sat, 07 Sep 2013 17:11:07 -0400 + +python3-defaults (3.3.2-15) unstable; urgency=low + + * Drop non-existing :any from python3-minimal build-dep. + + -- Scott Kitterman Sun, 18 Aug 2013 11:38:29 -0400 + +python3-defaults (3.3.2-14) unstable; urgency=low + + * Add python3.1 and python3.2 to unsupported-versions + * Build-depend on python3-minimal:any instead of python since that's what's + used during the build now + * Build-depend on python3-docutils instead of python-docutils + * Add Multi-Arch: allowed for python3-all and python3-all-dbg + * Add libpython3-dbg to python3-dbg depends + * Add libpython3-dev to python3-dev depends + * Use generated depends in control.in for libpython3-stdlib as with other + binaries + * Set UPSTRVER for Ubuntu in debian/rules so correct results are produced in + both Debian and Ubuntu + + -- Scott Kitterman Sun, 18 Aug 2013 06:22:22 -0400 + +python3-defaults (3.3.2-13) unstable; urgency=low + + * Bump python3-minimal Breaks/Replaces python3 versions to 3.3.2-13~ to + account for files moved in -4 and later (Closes: #718734) + * Fix broken libpython3-all-dbg symlink + + -- Scott Kitterman Mon, 05 Aug 2013 02:25:13 -0400 + +python3-defaults (3.3.2-12) unstable; urgency=low + + * Re-upload with a version newer than the one in experimental. + * Build libpython3-all-{dev,dbg} and libpython3-stdlib packages. + * Move debiandoc-sgml and lsb-release from Build-Depends-Indep to + Build-Depends. + + -- Matthias Klose Sat, 03 Aug 2013 09:52:26 +0200 + +python3-defaults (3.3.2-5) unstable; urgency=low + + * Drop python3.2 from supported python3 versions + + -- Scott Kitterman Fri, 02 Aug 2013 22:58:22 -0400 + +python3-defaults (3.3.2-4) unstable; urgency=low + + * Upload to unstable + * Remove /usr/share/python3/debpython/__pycache__ in python3-minimal's prerm + * Change source format back to 1.0 (native) + + -- Piotr Ożarowski Thu, 01 Aug 2013 21:41:34 +0200 + +python3-defaults (3.3.2-11) experimental; urgency=low + + * Make datetime module optional in debpython (it's not available in + python3.X-minimal, closes: #717232) + + -- Piotr Ożarowski Thu, 18 Jul 2013 22:50:17 +0200 + +python3-defaults (3.3.2-10) experimental; urgency=low + + [ Matthias Klose ] + * Move py3compile and py3clean back to the python3-minimal package. + + [ Piotr Ożarowski ] + * Remove pybuild and dh_python3, dh-python source package provides it now + * Add dh-python dependency in python3 package (to make sure dh_python3 is + installed) + * Bump Standards-Version to 3.9.4 + + -- Piotr Ożarowski Mon, 15 Jul 2013 23:48:04 +0200 + +python3-defaults (3.3.2-3) unstable; urgency=low + + * Bump python3-minimal Breaks/Replaces python3 versions to 3.3.2-1~ to + account for files moved in -2 (closes: #717373) + + -- Scott Kitterman Sun, 21 Jul 2013 09:30:39 -0400 + +python3-defaults (3.3.2-2) unstable; urgency=low + + [ Matthias Klose ] + * Build dependency packages as architecture dependent packages. + * Make python3, python3-{minimal,dev,dbg} Multi-Arch: allowed. + * Don't use the `u' abi flag when defaulting to 3.3. + * Build Multi-Arch: same packages libpython3-{dev,dbg} packages providing + $(DEB_HOST_MULTIARCH)-python3-config symlinks. + + [ Piotr Ożarowski ] + * Move python-docutils to Build-Depends (python3 package is now arch:any) + + [ Dmitry Shachnev ] + * Include architecture.mk in debian/rules instead of defining + DEB_HOST_* manually. + + [ Scott Kitterman ] + * Correct doc directory in README.Debian + * Bump standards version to 3.9.4 without further change + + -- Scott Kitterman Wed, 17 Jul 2013 17:14:22 -0400 + +python3-defaults (3.3.2-1) unstable; urgency=low + + [ Scott Kitterman ] + * Make python3.3 the default python3 + * When X-Python3-Version is not present, do not describe it as missing, + just indicate it is not there + + [ Matthias Klose ] + * Bump version to 3.3.2. + * Don't use the `u' abi flag when defaulting to 3.3. + + -- Scott Kitterman Sun, 14 Jul 2013 18:35:33 -0400 + +python3-defaults (3.3.0-3) experimental; urgency=low + + [ Piotr Ożarowski ] + * pybuild: + - add --ext-dest-dir (PYBUILD_EXT_DESTDIR) and --ext-pattern + (PYBUILD_EXT_PATTERN) options to move files after install step + - save before/after command logs if quiet mode is on + - do not warn about limiting versions if there's only one + - distutils plugin: do not skip build in install target + (ugly workaround for yet another distutils "feature", + closes: #701137) + - do not run tests if DEB_BUILD_OPTIONS contains "nocheck" + * dh_python3: + - add version range to py3compile in maintainer scripts + - no longer sensitive to trailing slash in private dir names + (closes: #701215) + * Bump minimum required dpkg-dev build dependency to 1.16.1~ + (due to architecture.mk in debian/rules) + + [ Dmitry Shachnev ] + * Include architecture.mk in debian/rules instead of defining + DEB_HOST_* manually. + * tests/t1: Build-depend on python3-all instead of python-all. + * Make tests work without python-support installed. + * debian/tests/control: Add a dependency on libjs-jquery (test1 contains + a symlink to /usr/share/javascript/jquery/jquery.js). + * Added missing docinfo to man pages, to fix a lintian warning + (Closes: #702777). + + [ Matthias Klose ] + * dh_python3: Use the multiarch tuple for the host (if DEB_HOST_MULTIARCH + is set in the environment). + * Add a libpython3-stdlib package (not yet built). + + -- Piotr Ożarowski Sun, 17 Mar 2013 13:47:29 +0100 + +python3-defaults (3.3.0-2) experimental; urgency=low + + [ Piotr Ożarowski ] + * dh_python3: + - add multiarch support (rename extensions in dist-packages) + - rename foomodule.so to foo.so in dist-packages (for Python >= 3.3) + * pybuild: + - add --{before,after}-{clean,configure,build,install,test} + command line options and many more PYBUILD_FOO environment vars + (f.e. PYBUILD_DESTDIR, PYBUILD_DESTDIR_python3, + PYBUILD_DESTDIR_python3.3-dbg) + - add --disable command line option (to disable step, interpreter, version + or any mix of them); drop --no-clean and --no-tests arguments + (replaced by --disable clean, --disable test or --disable 'clean test') + - add new build system to dh sequencer (dh --buildsystem=pybuild) + - add manpage + * Move python-docutils to Build-Depends (python3 package is now arch:any) + + [ Matthias Klose ] + * Build dependency packages as architecture dependent packages. + * Make python3, python3-{minimal,dev,dbg} Multi-Arch: allowed. + * Don't use the `u' abi flag when defaulting to 3.3. + * Build Multi-Arch: same packages libpython3-{dev,dbg} packages providing + $(DEB_HOST_MULTIARCH)-python3-config symlinks. + * Add Multi-Arch: same packages libpython3-all-{dev,dbg} (not yet built, + python3.2 doesn't have support for multiarch). + + [ Dmitry Shachnev ] + * debpython/interpreter.py: fix failing doctest + (architecture no longer hardcoded) + * Added DEP-8 tests (Closes: #698002). + + -- Piotr Ożarowski Sat, 12 Jan 2013 17:13:14 +0100 + +python3-defaults (3.3.0-1) experimental; urgency=low + + [ Piotr Ożarowski ] + * Add Python 3.3 to the list of supported Python 3 versions and make it a + default one. + * dh_python3: + - remove egg-info file/dir while moving files to common directory + if the later one already contains it + * rewrite dh_python3.1, py3compile.1 and py3clean.1 manpages in + ReStructured Text + * Add pybuild + + [ Scott Kitterman ] + * Update Makefile to install pybuild + * Fix file name typo in README.derivatives + + -- Scott Kitterman Mon, 26 Nov 2012 09:20:46 -0500 + +python3-defaults (3.2.3-7) unstable; urgency=low + + * Add Python 3.3 as a supported Python version. + + -- Matthias Klose Mon, 06 May 2013 03:05:02 +0200 + +python3-defaults (3.2.3-6) unstable; urgency=low + + [ Piotr Ożarowski ] + * dh_python3 + - ignore empty files while trying to normalize shebangs + - mention the right file (debian/py3dist-overrides) while warning about + guessed dependency - thanks to Sebastian Ramacher for the patch + (Closes: #685067) + - fix generating dependencies when maximum version is specified + (Closes: #687060) + * py3versions.py: fix parsing DEBPYTHON3_SUPPORTED env. variable + (versions should be separated using comma, as in debian_defaults + config file) + * py3versions, debpython: close previously opened files - thanks to Dmitry + Shachnev for the patch (Closes: #686587) + + [ Dmitry Shachnev ] + [ Barry Warsaw ] + * py3clean: Don't remove everything in the __pycache__ directory for + system site package directories. Prevents bogus cleaning of unrelated + *.pyc files. Original patch by Dmitry, with review, clean up, small + modifications, and additional comments by Barry. (Closes: #685167) + + [ Barry Warsaw ] + * dh_python3: Rework calculation of extension tags to add support for + Python 3.3's different suffixes, and to allow for unadorned .so files + to assume they are built with the default Python 3 version. + Closes: 672178 + * README.derivatives: It is no longer necessary to edit + debian/py3versions.py since the values are taken from + debian_defaults. Also added some text on how to separate the + specification when multiple versions are supported. + * Makefile: Fix the nosetests3 command. Closes: 690259 + + -- Piotr Ożarowski Sun, 21 Oct 2012 21:29:45 +0200 + +python3-defaults (3.2.3-5) unstable; urgency=low + + * dh_python3: + - do not rewrite /usr/bin/python{,2.*} shebangs + (Closes: #683294, /me still thinks it was a feature, not a bug) + - parsing debian/control fields is now case insensitive + * Change source format from native to 3.0 (native) + + -- Piotr Ożarowski Thu, 02 Aug 2012 23:26:08 +0200 + +python3-defaults (3.2.3-4) unstable; urgency=high + + * py3clean: really close #681389 + + -- Piotr Ożarowski Thu, 12 Jul 2012 22:45:47 -0600 + +python3-defaults (3.2.3-3) unstable; urgency=high + + * Yet another update in SHEBANG_RE to handle even more cases + * test4 fixed to catch missing /usr/bin/python → /usr/bin/python3 rewrites + * py3clean: accept --package *and* directory name at the same time + (change missed in -1 upload, closes: #681389) + * Bump minimum required python3 version to 3.2.3-3~ in packages with .py files + (due to --package option that is added to py3compile/py3clean in rtupdate + scripts) + + -- Piotr Ożarowski Thu, 12 Jul 2012 12:40:42 -0600 + +python3-defaults (3.2.3-2) unstable; urgency=high + + * Urgency high for grave bug because this will cause other packages to + misbuild + * Correct SHEBANG_RE in debpython/tools.py to not capture the 3 from python3 + (Closes: #681235) + + -- Scott Kitterman Wed, 11 Jul 2012 11:51:46 -0400 + +python3-defaults (3.2.3-1) unstable; urgency=low + + * Bump upstream version to match current unstable/wheezy python3.2 version + * dh_python3: + - generates rtupdate scripts for private directories that compile files + from given package only, add --compile-all to dh_python3's call if you + want the old behaviour (i.e. compile also files (plugins?) provided by + other packages, which do not use a helper/bytecompile them) + - rewrite shebangs by default (disable via --no-shebang-rewrite), + examples: + + "/usr/bin/env python3*" → "/usr/bin/python3*" + + "/usr/local/bin/python3 foo" → "/usr/bin/python3 foo" + - new --shebang option to replace all shebangs in bin dirs + (example: --shebang /usr/bin/python3) + - translate Python version numbers into Debian ones for those + require.txt items that have a pydist file with (uscan like) rules + or PEP386 flag + * py3versions, dh_python3, py3compile: allow to override system's list of + supported Python3 versions via DEBPYTHON3_SUPPORTED and default Python3 + version via DEBPYTHON3_DEFAULT env. variables + * Debhelper's python3 sequence now inserts dh_python3 before dh_installinit + + -- Piotr Ożarowski Sat, 30 Jun 2012 15:20:39 +0200 + +python3-defaults (3.2.3~rc2-1) unstable; urgency=low + + [ Scott Kitterman ] + * Drop unused XS-Python-Version support from dh_python3 + * Remove unused debian/pyversions support from dh_python3 + * Remove unused support for comma delimited lists of versions with + X-Python3-Version from py3versions and debpython/debhelper.py (dh_python3) + * Clean up log messages in py3versions a bit + * Remove unused code related to parsing debian/pyversions from + debian/py3versions + * idle3 should Break as well as Replace python3 + * Correct Python package names with hyphens in them being ignored + (Closes: #657667) + * Fix python3.2 related deprecation and resource warnings in + debian/py3versions.py (Closes: #670471) + * Drop -n from /usr/bin/idle3 invocations in debian/idle.desktop and + debian/idle.menu (Closes: #671704) + * dh_python3, py3versions: make comparison of X-Python-Version field names + case-insensitive (Closes: #676225) + - Change based on Piotr Ożarowski's change for python-defaults + * Bump upstream version number to match python3.2 (3.2.3~rc2) + * Bump minimum debhelper version to 7.0.50~ to support minumum version + needed by tests + * Add debian/python3-minimal.postinst.in and python3-minimal.prerm to + support byte compiling py3versions.py (Closes: #672226) + - byte compiling only works if py3compile is present, which it may not be + on fresh installs, but removing .pyc files is reliable (best we can do + without moving py3compile to python3-minimal + * Move /usr/bin/py3versions -> ../share/python3/py3versions.py symlink from + python3 to python3-minimal to match the change in python-defaults + - Add Breaks/Replaces + + [ Piotr Ożarowski ] + * Generate correct python3 (<< 3.X) dependencies when maximum Python 3 + version is specified (Closes: #675703) + + -- Scott Kitterman Tue, 05 Jun 2012 23:58:13 -0400 python3-defaults (3.2.3~rc1-2) unstable; urgency=low diff -Nru python3-defaults-3.2.3/debian/control python3-defaults-3.4.0/debian/control --- python3-defaults-3.2.3/debian/control 2012-04-15 05:07:36.000000000 +0000 +++ python3-defaults-3.4.0/debian/control 2014-03-22 20:13:35.000000000 +0000 @@ -4,16 +4,18 @@ Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Matthias Klose Uploaders: Piotr Ożarowski , Scott Kitterman -Build-Depends: debhelper (>= 6.0.7~), python -Build-Depends-Indep: libhtml-tree-perl, debiandoc-sgml, python-docutils, lsb-release -Standards-Version: 3.9.3 +Build-Depends: debhelper (>= 7.0.50~), python3-minimal:any, python3.4-minimal:any, python3-docutils, + dpkg-dev (>= 1.16.1~), debiandoc-sgml, lsb-release +Build-Depends-Indep: libhtml-tree-perl +Standards-Version: 3.9.5 Homepage: http://www.python.org/ Vcs-Bzr: http://alioth.debian.org/anonscm/bzr/pkg-python/python3-defaults-debian Vcs-Browser: http://alioth.debian.org/scm/loggerhead/pkg-python/python3-defaults-debian/files Package: python3 -Architecture: all -Depends: python3.2 (>= 3.2.3), python3-minimal (= ${binary:Version}), ${misc:Depends} +Architecture: any +Multi-Arch: allowed +Depends: python3.4 (>= 3.4.0-0~), python3-minimal (= ${binary:Version}), libpython3-stdlib (= ${binary:Version}), ${misc:Depends}, dh-python Suggests: python3-doc (>= ${binary:Version}), python3-tk (>= ${binary:Version}) Replaces: python3-minimal (<< 3.1.2-2) Provides: python3-profiler @@ -23,32 +25,34 @@ network programming, system administration, sounds and graphics. . This package is a dependency package, which depends on Debian's default - Python 3 version (currently v3.2). + Python 3 version (currently v3.4). Package: python3-minimal -Architecture: all -Depends: python3.2-minimal (>= 3.2.3), dpkg (>= 1.13.20), ${misc:Depends} -Breaks: python3-dev (<< 3.1), python3-dbg (<< 3.1), python3-all (<< 3.1), python3-all-dev (<< 3.1), python3-all-dbg (<< 3.1), python3-examples (<< 3.1), idle3 (<< 3.1) -Replaces: python3.1 (<< 3.1-2) +Architecture: any +Multi-Arch: allowed +Depends: python3.4-minimal (>= 3.4.0-0~), dpkg (>= 1.13.20), ${misc:Depends} +Breaks: python3 (<< 3.3.2-13~), python3-dev (<< 3.1), python3-dbg (<< 3.1), python3-all (<< 3.1), python3-all-dev (<< 3.1), python3-all-dbg (<< 3.1), python3-examples (<< 3.1), idle3 (<< 3.1) +Replaces: python3 (<< 3.3.2-13~), python3.1 (<< 3.1-2) Description: minimal subset of the Python language (default python3 version) This package contains the interpreter and some essential modules. It's used in the boot process for some basic tasks. - See /usr/share/doc/python3.2-minimal/README.Debian for a list of the modules + See /usr/share/doc/python3.4-minimal/README.Debian for a list of the modules contained in this package. Package: python3-examples Architecture: all -Depends: python3 (= ${binary:Version}), python3.2-examples (>= 3.2.3), ${misc:Depends} +Depends: python3 (>= ${binary:Version}), python3.4-examples (>= 3.4.0-0~), ${misc:Depends} Description: examples for the Python language (default version) Examples, Demos and Tools for Python. These are files included in the upstream Python distribution. . This package is a dependency package, which depends on Debian's default - Python 3 version (currently v3.2). + Python 3 version (currently v3.4). Package: python3-dev -Architecture: all -Depends: python3 (= ${binary:Version}), python3.2-dev (>= 3.2.3), ${misc:Depends} +Architecture: any +Multi-Arch: allowed +Depends: python3 (= ${binary:Version}), libpython3-dev (= ${binary:Version}), python3.4-dev (>= 3.4.0-0~), ${misc:Depends} Replaces: python3.1 (<< 3.1.2+20100706-3) Description: header files and a static library for Python (default) Header files, a static library and development tools for building @@ -56,29 +60,53 @@ in applications. . This package is a dependency package, which depends on Debian's default - Python 3 version (currently v3.2). + Python 3 version (currently v3.4). + +Package: libpython3-dev +Architecture: any +Multi-Arch: same +Depends: libpython3.4-dev (>= 3.4.0-0~), ${misc:Depends} +Description: header files and a static library for Python (default) + Header files, a static library and development tools for building + Python modules, extending the Python interpreter or embedding Python + in applications. + . + This package is a dependency package, which depends on Debian's default + Python 3 version (currently v3.4). + +Package: libpython3-stdlib +Architecture: any +Multi-Arch: same +Depends: libpython3.4-stdlib (>= 3.4.0-0~), ${misc:Depends} +Description: interactive high-level object-oriented language (default python3 version) + Python, the high-level, interactive object oriented language, + includes an extensive class library with lots of goodies for + network programming, system administration, sounds and graphics. + . + This package is a dependency package, which depends on Debian's default + Python 3 version (currently v3.4). Package: idle3 Architecture: all -Depends: python3 (= ${binary:Version}), python3-tk, ${misc:Depends}, idle-python3.2 -Replaces: python3 (<< 3.2.3~rc1-2~) -Breaks: python3 (<< 3.2.3~rc1-2~) +Depends: python3 (>= ${binary:Version}), python3-tk, ${misc:Depends}, idle-python3.4 +Replaces: python3 (<< 3.2.3-1~) +Breaks: python3 (<< 3.2.3-1~) Enhances: python3 Description: IDE for Python using Tkinter (default version) IDLE is an Integrated Development Environment for Python. IDLE is written using Tkinter and therefore quite platform-independent. . This package is a dependency package, which depends on Debian's default - Python 3 version (currently v3.2). + Python 3 version (currently v3.4). Package: python3-doc Section: doc Architecture: all -Depends: python3.2-doc (>= 3.2.3), ${misc:Depends} +Depends: python3.4-doc (>= 3.4.0-0~), ${misc:Depends} Suggests: python3 (>= ${binary:Version}), python3-examples Description: documentation for the high-level object-oriented language Python 3 This is the official set of documentation for the interactive high-level - object-oriented language Python 3 (v3.2). All documents are provided + object-oriented language Python 3 (v3.4). All documents are provided in HTML format, some in info format. The package consists of nine documents: . * Tutorial @@ -92,22 +120,35 @@ * Distributing Python Modules . This package is a dependency package, which depends on Debian's default - Python 3 version (currently v3.2). + Python 3 version (currently v3.4). Package: python3-dbg -Architecture: all +Architecture: any +Multi-Arch: allowed Section: debug Priority: extra -Depends: python3 (= ${binary:Version}), python3.2-dbg (>= 3.2.3), ${misc:Depends} -Description: debug build of the Python 3 Interpreter (version 3.2) +Depends: python3 (= ${binary:Version}), libpython3-dbg (= ${binary:Version}), python3.4-dbg (>= 3.4.0-0~), ${misc:Depends} +Description: debug build of the Python 3 Interpreter (version 3.4) Python 3 interpreter configured with --pydebug. Dynamically loaded modules - are searched in /usr/lib/python3.2/lib-dynload/debug first. + are searched in /usr/lib/python3.4/lib-dynload/debug first. + +Package: libpython3-dbg +Architecture: any +Multi-Arch: same +Section: debug +Priority: extra +Depends: libpython3.4-dbg (>= 3.4.0-0~), ${misc:Depends} +Description: debug build of the Python 3 Interpreter (version 3.4) + Python 3 interpreter configured with --pydebug. Dynamically loaded modules + are searched in /usr/lib/python3.4/lib-dynload/debug first. Package: python3-all -Architecture: all -Depends: python3 (= ${binary:Version}), python3.2, ${misc:Depends} +Architecture: any +Multi-Arch: allowed +Depends: python3 (= ${binary:Version}), ${misc:Depends}, + python3.4 Description: package depending on all supported Python 3 runtime versions - The package currently depends on python3.2, in the future, + The package currently depends on python3.4, in the future, dependencies on jython (Python for a JVM) and ironpython (Python for Mono) may be added. . @@ -115,10 +156,12 @@ packages to avoid hardcoded dependencies on specific Python 3 runtimes. Package: python3-all-dev -Architecture: all -Depends: python3 (= ${binary:Version}), python3-all (= ${binary:Version}), python3-dev (= ${binary:Version}), python3.2-dev, ${misc:Depends} +Architecture: any +Multi-Arch: allowed +Depends: python3 (= ${binary:Version}), libpython3-all-dev (= ${binary:Version}), python3-all (= ${binary:Version}), python3-dev (= ${binary:Version}), ${misc:Depends}, + python3.4-dev Description: package depending on all supported Python 3 development packages - The package currently depends on python3.2-dev, in the + The package currently depends on python3.4-dev, in the future, dependencies on jython (Python for a JVM) and ironpython (Python for Mono) may be added. . @@ -127,12 +170,43 @@ packages. Package: python3-all-dbg -Architecture: all +Architecture: any +Multi-Arch: allowed +Section: debug +Priority: extra +Depends: python3 (= ${binary:Version}), libpython3-all-dbg (= ${binary:Version}), python3-all (= ${binary:Version}), python3-dbg (= ${binary:Version}), ${misc:Depends}, + python3.4-dbg +Description: package depending on all supported Python 3 debugging packages + The package currently depends on python3.4-dbg, in the + future, dependencies on jython (Python for a JVM) and ironpython (Python + for Mono) may be added. + . + This package is a dependency package used as a build dependency for other + packages to avoid hardcoded dependencies on specific Python 3 debug packages. + +Package: libpython3-all-dev +Architecture: any +Multi-Arch: same +Depends: libpython3-dev (= ${binary:Version}), ${misc:Depends}, + libpython3.4-dev +Description: package depending on all supported Python 3 development packages + The package currently depends on libpython3.4-dev, in the + future, dependencies on jython (Python for a JVM) and ironpython (Python + for Mono) may be added. + . + This package is a dependency package used as a build dependency for other + packages to avoid hardcoded dependencies on specific Python 3 development + packages. + +Package: libpython3-all-dbg +Architecture: any +Multi-Arch: same Section: debug Priority: extra -Depends: python3 (= ${binary:Version}), python3-all (= ${binary:Version}), python3-dbg (= ${binary:Version}), python3.2-dbg, ${misc:Depends} +Depends: libpython3-dbg (= ${binary:Version}), ${misc:Depends}, + libpython3.4-dbg Description: package depending on all supported Python 3 debugging packages - The package currently depends on python3.2-dbg, in the + The package currently depends on libpython3.4-dbg, in the future, dependencies on jython (Python for a JVM) and ironpython (Python for Mono) may be added. . diff -Nru python3-defaults-3.2.3/debian/control.in python3-defaults-3.4.0/debian/control.in --- python3-defaults-3.2.3/debian/control.in 2012-04-15 05:06:21.000000000 +0000 +++ python3-defaults-3.4.0/debian/control.in 2014-03-22 19:54:47.000000000 +0000 @@ -3,16 +3,18 @@ Priority: optional Maintainer: Matthias Klose Uploaders: Piotr Ożarowski , Scott Kitterman -Build-Depends: debhelper (>= 6.0.7~), python -Build-Depends-Indep: libhtml-tree-perl, debiandoc-sgml, python-docutils, lsb-release -Standards-Version: 3.9.3 +Build-Depends: debhelper (>= 7.0.50~), python3-minimal:any, python3.4-minimal:any, python3-docutils, + dpkg-dev (>= 1.16.1~), debiandoc-sgml, lsb-release +Build-Depends-Indep: libhtml-tree-perl +Standards-Version: 3.9.5 Homepage: http://www.python.org/ Vcs-Bzr: http://alioth.debian.org/anonscm/bzr/pkg-python/python3-defaults-debian Vcs-Browser: http://alioth.debian.org/scm/loggerhead/pkg-python/python3-defaults-debian/files Package: python3 -Architecture: all -Depends: @PVER@ (>= @PREVVER@), python3-minimal (= ${binary:Version}), ${misc:Depends} +Architecture: any +Multi-Arch: allowed +Depends: python@VER@ (>= @UPSTRVER@), python3-minimal (= ${binary:Version}), libpython3-stdlib (= ${binary:Version}), ${misc:Depends}, dh-python Suggests: python3-doc (>= ${binary:Version}), python3-tk (>= ${binary:Version}) Replaces: python3-minimal (<< 3.1.2-2) Provides: python3-profiler @@ -25,19 +27,20 @@ Python 3 version (currently v@VER@). Package: python3-minimal -Architecture: all -Depends: @PVER@-minimal (>= @PREVVER@), dpkg (>= 1.13.20), ${misc:Depends} -Breaks: python3-dev (<< 3.1), python3-dbg (<< 3.1), python3-all (<< 3.1), python3-all-dev (<< 3.1), python3-all-dbg (<< 3.1), python3-examples (<< 3.1), idle3 (<< 3.1) -Replaces: python3.1 (<< 3.1-2) +Architecture: any +Multi-Arch: allowed +Depends: python@VER@-minimal (>= @UPSTRVER@), dpkg (>= 1.13.20), ${misc:Depends} +Breaks: python3 (<< 3.3.2-13~), python3-dev (<< 3.1), python3-dbg (<< 3.1), python3-all (<< 3.1), python3-all-dev (<< 3.1), python3-all-dbg (<< 3.1), python3-examples (<< 3.1), idle3 (<< 3.1) +Replaces: python3 (<< 3.3.2-13~), python3.1 (<< 3.1-2) Description: minimal subset of the Python language (default python3 version) This package contains the interpreter and some essential modules. It's used in the boot process for some basic tasks. - See /usr/share/doc/@PVER@-minimal/README.Debian for a list of the modules + See /usr/share/doc/python@VER@-minimal/README.Debian for a list of the modules contained in this package. Package: python3-examples Architecture: all -Depends: python3 (= ${binary:Version}), @PVER@-examples (>= @PREVVER@), ${misc:Depends} +Depends: python3 (>= ${binary:Version}), python@VER@-examples (>= @UPSTRVER@), ${misc:Depends} Description: examples for the Python language (default version) Examples, Demos and Tools for Python. These are files included in the upstream Python distribution. @@ -46,8 +49,9 @@ Python 3 version (currently v@VER@). Package: python3-dev -Architecture: all -Depends: python3 (= ${binary:Version}), @PVER@-dev (>= @PREVVER@), ${misc:Depends} +Architecture: any +Multi-Arch: allowed +Depends: python3 (= ${binary:Version}), libpython3-dev (= ${binary:Version}), python@VER@-dev (>= @UPSTRVER@), ${misc:Depends} Replaces: python3.1 (<< 3.1.2+20100706-3) Description: header files and a static library for Python (default) Header files, a static library and development tools for building @@ -57,11 +61,35 @@ This package is a dependency package, which depends on Debian's default Python 3 version (currently v@VER@). +Package: libpython3-dev +Architecture: any +Multi-Arch: same +Depends: libpython@VER@-dev (>= @UPSTRVER@), ${misc:Depends} +Description: header files and a static library for Python (default) + Header files, a static library and development tools for building + Python modules, extending the Python interpreter or embedding Python + in applications. + . + This package is a dependency package, which depends on Debian's default + Python 3 version (currently v@VER@). + +Package: libpython3-stdlib +Architecture: any +Multi-Arch: same +Depends: libpython@VER@-stdlib (>= @UPSTRVER@), ${misc:Depends} +Description: interactive high-level object-oriented language (default python3 version) + Python, the high-level, interactive object oriented language, + includes an extensive class library with lots of goodies for + network programming, system administration, sounds and graphics. + . + This package is a dependency package, which depends on Debian's default + Python 3 version (currently v@VER@). + Package: idle3 Architecture: all -Depends: python3 (= ${binary:Version}), python3-tk, ${misc:Depends}, idle-@PVER@ -Replaces: python3 (<< 3.2.3~rc1-2~) -Breaks: python3 (<< 3.2.3~rc1-2~) +Depends: python3 (>= ${binary:Version}), python3-tk, ${misc:Depends}, idle-python@VER@ +Replaces: python3 (<< 3.2.3-1~) +Breaks: python3 (<< 3.2.3-1~) Enhances: python3 Description: IDE for Python using Tkinter (default version) IDLE is an Integrated Development Environment for Python. @@ -73,7 +101,7 @@ Package: python3-doc Section: doc Architecture: all -Depends: python@VER@-doc (>= @PREVVER@), ${misc:Depends} +Depends: python@VER@-doc (>= @UPSTRVER@), ${misc:Depends} Suggests: python3 (>= ${binary:Version}), python3-examples Description: documentation for the high-level object-oriented language Python 3 This is the official set of documentation for the interactive high-level @@ -94,19 +122,32 @@ Python 3 version (currently v@VER@). Package: python3-dbg -Architecture: all +Architecture: any +Multi-Arch: allowed Section: debug Priority: extra -Depends: python3 (= ${binary:Version}), python@VER@-dbg (>= @PREVVER@), ${misc:Depends} +Depends: python3 (= ${binary:Version}), libpython3-dbg (= ${binary:Version}), python@VER@-dbg (>= @UPSTRVER@), ${misc:Depends} +Description: debug build of the Python 3 Interpreter (version @VER@) + Python 3 interpreter configured with --pydebug. Dynamically loaded modules + are searched in /usr/lib/python@VER@/lib-dynload/debug first. + +Package: libpython3-dbg +Architecture: any +Multi-Arch: same +Section: debug +Priority: extra +Depends: libpython@VER@-dbg (>= @UPSTRVER@), ${misc:Depends} Description: debug build of the Python 3 Interpreter (version @VER@) Python 3 interpreter configured with --pydebug. Dynamically loaded modules are searched in /usr/lib/python@VER@/lib-dynload/debug first. Package: python3-all -Architecture: all -Depends: python3 (= ${binary:Version}), python3.2, ${misc:Depends} +Architecture: any +Multi-Arch: allowed +Depends: python3 (= ${binary:Version}), ${misc:Depends}, + python3.4 Description: package depending on all supported Python 3 runtime versions - The package currently depends on python3.2, in the future, + The package currently depends on python3.4, in the future, dependencies on jython (Python for a JVM) and ironpython (Python for Mono) may be added. . @@ -114,10 +155,12 @@ packages to avoid hardcoded dependencies on specific Python 3 runtimes. Package: python3-all-dev -Architecture: all -Depends: python3 (= ${binary:Version}), python3-all (= ${binary:Version}), python3-dev (= ${binary:Version}), python3.2-dev, ${misc:Depends} +Architecture: any +Multi-Arch: allowed +Depends: python3 (= ${binary:Version}), libpython3-all-dev (= ${binary:Version}), python3-all (= ${binary:Version}), python3-dev (= ${binary:Version}), ${misc:Depends}, + python3.4-dev Description: package depending on all supported Python 3 development packages - The package currently depends on python3.2-dev, in the + The package currently depends on python3.4-dev, in the future, dependencies on jython (Python for a JVM) and ironpython (Python for Mono) may be added. . @@ -126,12 +169,43 @@ packages. Package: python3-all-dbg -Architecture: all +Architecture: any +Multi-Arch: allowed +Section: debug +Priority: extra +Depends: python3 (= ${binary:Version}), libpython3-all-dbg (= ${binary:Version}), python3-all (= ${binary:Version}), python3-dbg (= ${binary:Version}), ${misc:Depends}, + python3.4-dbg +Description: package depending on all supported Python 3 debugging packages + The package currently depends on python3.4-dbg, in the + future, dependencies on jython (Python for a JVM) and ironpython (Python + for Mono) may be added. + . + This package is a dependency package used as a build dependency for other + packages to avoid hardcoded dependencies on specific Python 3 debug packages. + +Package: libpython3-all-dev +Architecture: any +Multi-Arch: same +Depends: libpython3-dev (= ${binary:Version}), ${misc:Depends}, + libpython3.4-dev +Description: package depending on all supported Python 3 development packages + The package currently depends on libpython3.4-dev, in the + future, dependencies on jython (Python for a JVM) and ironpython (Python + for Mono) may be added. + . + This package is a dependency package used as a build dependency for other + packages to avoid hardcoded dependencies on specific Python 3 development + packages. + +Package: libpython3-all-dbg +Architecture: any +Multi-Arch: same Section: debug Priority: extra -Depends: python3 (= ${binary:Version}), python3-all (= ${binary:Version}), python3-dbg (= ${binary:Version}), python3.2-dbg, ${misc:Depends} +Depends: libpython3-dbg (= ${binary:Version}), ${misc:Depends}, + libpython3.4-dbg Description: package depending on all supported Python 3 debugging packages - The package currently depends on python3.2-dbg, in the + The package currently depends on libpython3.4-dbg, in the future, dependencies on jython (Python for a JVM) and ironpython (Python for Mono) may be added. . diff -Nru python3-defaults-3.2.3/debian/copyright python3-defaults-3.4.0/debian/copyright --- python3-defaults-3.2.3/debian/copyright 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/debian/copyright 2013-08-03 07:34:39.000000000 +0000 @@ -296,9 +296,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -dh_python3, py3compile, py3clean and debpython module: -====================================================== -Copyright © 2010 Piotr Ożarowski +py3compile, py3clean and debpython module: +========================================== +Copyright © 2010-2013 Piotr Ożarowski Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff -Nru python3-defaults-3.2.3/debian/debian_defaults python3-defaults-3.4.0/debian/debian_defaults --- python3-defaults-3.2.3/debian/debian_defaults 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/debian/debian_defaults 2014-03-22 19:51:43.000000000 +0000 @@ -1,12 +1,12 @@ [DEFAULT] # the default python3 version -default-version = python3.2 +default-version = python3.4 # all supported python3 versions -supported-versions = python3.2 +supported-versions = python3.4 # formerly supported python3 versions -old-versions = python3.1 +old-versions = python3.1, python3.2, python3.3 # unsupported versions, including older versions -unsupported-versions = +unsupported-versions = python3.1, python3.2, python3.3 diff -Nru python3-defaults-3.2.3/debian/idle3.desktop python3-defaults-3.4.0/debian/idle3.desktop --- python3-defaults-3.2.3/debian/idle3.desktop 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/debian/idle3.desktop 2012-12-03 21:49:53.000000000 +0000 @@ -1,7 +1,7 @@ [Desktop Entry] Name=IDLE 3 Comment=Integrated DeveLopment Environment for Python3 -Exec=/usr/bin/idle3 -n +Exec=/usr/bin/idle3 Icon=/usr/share/pixmaps/idle3.xpm Terminal=false Type=Application diff -Nru python3-defaults-3.2.3/debian/idle3.menu python3-defaults-3.4.0/debian/idle3.menu --- python3-defaults-3.2.3/debian/idle3.menu 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/debian/idle3.menu 2012-12-03 21:49:53.000000000 +0000 @@ -1,5 +1,5 @@ ?package(idle3):needs="X11" section="Applications/Programming"\ title="IDLE (Python3 IDE)"\ icon="/usr/share/pixmaps/idle3.xpm"\ - command="/usr/bin/idle3 -n" \ + command="/usr/bin/idle3" \ hints="Environments" diff -Nru python3-defaults-3.2.3/debian/py3versions.1 python3-defaults-3.4.0/debian/py3versions.1 --- python3-defaults-3.2.3/debian/py3versions.1 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/debian/py3versions.1 2012-12-03 21:49:53.000000000 +0000 @@ -21,10 +21,10 @@ .TP .I -r, --requested [|] Reads the value of the -.B XS-Python-Version +.B X-Python3-Version field in the source section of a control file and shows all matching python3 versions. The parameter is interpreted as a version string, if -it is not the name of a file. If the XS-Python-Version field is +it is not the name of a file. If the X-Python3-Version field is missing, it will fall back to list the supported Python3 versions after checking debian/control. Versions less than 3 are ignored. The keyword all is ignored because it covers all Python2 diff -Nru python3-defaults-3.2.3/debian/py3versions.py python3-defaults-3.4.0/debian/py3versions.py --- python3-defaults-3.2.3/debian/py3versions.py 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/debian/py3versions.py 2013-06-06 16:00:25.000000000 +0000 @@ -1,16 +1,32 @@ #! /usr/bin/python3 -import os, re, sys +import os +import re +import sys _defaults = None +_old_versions = None +_unsupported_versions = None +_supported_versions = ["python%s" % ver.strip() for ver in + os.environ.get('DEBPYTHON3_SUPPORTED', '').split(',') + if ver.strip()] +#_default_version = "python%s" % os.environ.get('DEBPYTHON3_DEFAULT', '') +#if _default_version == 'python': +# _default_version = None +_default_version = None + + def read_default(name=None): global _defaults - from configparser import SafeConfigParser, NoOptionError + from configparser import ConfigParser, NoOptionError if not _defaults: if os.path.exists('/usr/share/python3/debian_defaults'): - config = SafeConfigParser() - config.readfp(open('/usr/share/python3/debian_defaults')) + config = ConfigParser() + defaultsfile = open('/usr/share/python3/debian_defaults') + config.read_file(defaultsfile) + defaultsfile.close() _defaults = config + if _defaults and name: try: value = _defaults.get('DEFAULT', name) @@ -19,12 +35,14 @@ return value return None + def parse_versions(vstring): + if len(vstring.split(',')) > 2: + raise ValueError('too many arguments provided for X-Python3-Version: min and max only.') import operator - operators = { None: operator.eq, '=': operator.eq, - '>=': operator.ge, '<=': operator.le, - '<<': operator.lt - } + operators = {None: operator.eq, '=': operator.eq, + '>=': operator.ge, '<=': operator.le, + '<<': operator.lt} vinfo = {} exact_versions = set() version_range = set(supported_versions(version_only=True)) @@ -40,7 +58,7 @@ m = ve.match(field) try: if not m: - raise ValueError('error parsing Python-Version attribute') + raise ValueError('error parsing Python3-Version attribute') op, v = m.group(1), m.group(2) vmaj, vmin = v.split('.') if int(vmaj) < 3: @@ -50,16 +68,16 @@ else: relop_seen = True filtop = operators[op] - version_range = [av for av in version_range if filtop(av ,v)] + version_range = [av for av in version_range if filtop(av, v)] except Exception: - raise ValueError('error parsing Python-Version attribute') + raise ValueError('error parsing Python3-Version attribute') if 'versions' in vinfo: vinfo['versions'] = exact_versions if relop_seen: vinfo['versions'] = exact_versions.union(version_range) return vinfo -_old_versions = None + def old_versions(version_only=False): global _old_versions if not _old_versions: @@ -73,7 +91,7 @@ else: return _old_versions -_unsupported_versions = None + def unsupported_versions(version_only=False): global _unsupported_versions if not _unsupported_versions: @@ -87,7 +105,7 @@ else: return _unsupported_versions -_supported_versions = None + def supported_versions(version_only=False): global _supported_versions if not _supported_versions: @@ -116,21 +134,24 @@ 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/python3') + _default_version = os.readlink('/usr/bin/python3') # consistency check debian_default = read_default('default-version') if not _default_version in (debian_default, os.path.join('/usr/bin', debian_default)): - raise ValueError("the symlink /usr/bin/python3 does not point to the python3 default version. It must be reset to point to %s" % debian_default) + raise ValueError("the symlink /usr/bin/python3 does not point to the " + "python3 default version. It must be reset " + "to point to %s" % debian_default) _default_version = debian_default if version_only: return _default_version[6:] else: return _default_version + def requested_versions(vstring, version_only=False): versions = None vinfo = parse_versions(vstring) @@ -146,6 +167,7 @@ else: return ['python%s' % v for v in versions] + def installed_versions(version_only=False): import glob supported = supported_versions() @@ -158,11 +180,15 @@ else: return versions + class ControlFileValueError(ValueError): pass + + class MissingVersionValueError(ValueError): pass + def extract_pyversion_attribute(fn, pkg): """read the debian/control file, extract the X-Python3-Version field.""" @@ -170,8 +196,9 @@ version = None sversion = None section = None - for line in open(fn, encoding='utf-8'): - line = line.strip() + with open(fn, encoding='utf-8') as controlfile: + lines = [line.strip() for line in controlfile] + for line in lines: if line == '': if pkg == 'Source': break @@ -180,18 +207,20 @@ section = 'Source' elif line.startswith('Package: ' + pkg): section = pkg - elif line.startswith('X-Python3-Version:'): + elif line.lower().startswith('x-python3-version:'): if section != 'Source': raise ValueError('attribute X-Python3-Version not in Source section') sversion = line.split(':', 1)[1].strip() - if section == None: + if section is None: raise ControlFileValueError('not a control file') if pkg == 'Source': - if sversion == None: - raise MissingVersionValueError('missing X-Python3-Version in control file') + if sversion is None: + raise MissingVersionValueError('no X-Python3-Version in control file') return sversion return version + +''' def requested_versions_bis(vstring, version_only=False): versions = [] py_supported_short = supported_versions(version_only=True) @@ -218,14 +247,13 @@ if not version_only: versions=['python'+i for i in versions] return versions +''' -def extract_pyversion_attribute_bis(fn): - vstring = open(fn).readline().rstrip('\n') - return vstring def main(): from optparse import OptionParser - usage = '[-v] [-h] [-d|--default] [-s|--supported] [-i|--installed] [-r|--requested |]' + usage = '[-v] [-h] [-d|--default] [-s|--supported] [-i|--installed] ' + '[-r|--requested |]' parser = OptionParser(usage=usage) parser.add_option('-d', '--default', help='print the default python3 version', @@ -234,7 +262,9 @@ help='print the supported python3 versions', action='store_true', dest='supported') parser.add_option('-r', '--requested', - help='print the python3 versions requested by a build; the argument is either the name of a control file or the value of the X-Python3-Version attribute', + help='print the python3 versions requested by a build; ' + 'the argument is either the name of a control file ' + 'or the value of the X-Python3-Version attribute', action='store_true', dest='requested') parser.add_option('-i', '--installed', help='print the installed supported python3 versions', @@ -267,12 +297,13 @@ vstring = extract_pyversion_attribute(fn, 'Source') vs = requested_versions(vstring, opts.version_only) except ControlFileValueError: - sys.stderr.write("%s: not a control file: %s, " \ + sys.stderr.write("%s: not a control file: %s, " % (program, fn)) sys.exit(1) except MissingVersionValueError: - sys.stderr.write("%s: missing X-Python3-Version in control file, fall back to supported versions\n" \ - % program) + sys.stderr.write("%s: no X-Python3-Version in control " + "file, using supported versions\n" % + program) vs = supported_versions(opts.version_only) else: vs = requested_versions(versions, opts.version_only) diff -Nru python3-defaults-3.2.3/debian/python3-doc.docs python3-defaults-3.4.0/debian/python3-doc.docs --- python3-defaults-3.2.3/debian/python3-doc.docs 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/debian/python3-doc.docs 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -pydist/README.PyDist* \ No newline at end of file diff -Nru python3-defaults-3.2.3/debian/python3.install python3-defaults-3.4.0/debian/python3.install --- python3-defaults-3.2.3/debian/python3.install 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/debian/python3.install 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -pydist/dist_fallback /usr/share/python3/ diff -Nru python3-defaults-3.2.3/debian/python3.manpages python3-defaults-3.4.0/debian/python3.manpages --- python3-defaults-3.2.3/debian/python3.manpages 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/debian/python3.manpages 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -py3clean.1 -py3compile.1 -dh_python3.1 diff -Nru python3-defaults-3.2.3/debian/python3-minimal.manpages python3-defaults-3.4.0/debian/python3-minimal.manpages --- python3-defaults-3.2.3/debian/python3-minimal.manpages 1970-01-01 00:00:00.000000000 +0000 +++ python3-defaults-3.4.0/debian/python3-minimal.manpages 2013-08-03 07:34:39.000000000 +0000 @@ -0,0 +1,2 @@ +py3clean.1 +py3compile.1 diff -Nru python3-defaults-3.2.3/debian/python3-minimal.postinst.in python3-defaults-3.4.0/debian/python3-minimal.postinst.in --- python3-defaults-3.2.3/debian/python3-minimal.postinst.in 1970-01-01 00:00:00.000000000 +0000 +++ python3-defaults-3.4.0/debian/python3-minimal.postinst.in 2012-12-03 21:49:53.000000000 +0000 @@ -0,0 +1,8 @@ +#! /bin/sh +set -e + +if which py3compile >/dev/null 2>&1; then + py3compile -p python3-minimal /usr/share/python3/ +fi + +#DEBHELPER# diff -Nru python3-defaults-3.2.3/debian/python3-minimal.prerm python3-defaults-3.4.0/debian/python3-minimal.prerm --- python3-defaults-3.2.3/debian/python3-minimal.prerm 1970-01-01 00:00:00.000000000 +0000 +++ python3-defaults-3.4.0/debian/python3-minimal.prerm 2013-08-03 07:34:39.000000000 +0000 @@ -0,0 +1,7 @@ +#! /bin/sh +set -e + +rm -rf /usr/share/python3/__pycache__ +rm -rf /usr/share/python3/debpython/__pycache__ + +#DEBHELPER# diff -Nru python3-defaults-3.2.3/debian/python3.prerm python3-defaults-3.4.0/debian/python3.prerm --- python3-defaults-3.2.3/debian/python3.prerm 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/debian/python3.prerm 2012-12-03 21:49:53.000000000 +0000 @@ -1,4 +1,5 @@ -#! /bin/sh -e +#! /bin/sh +set -e if which py3clean >/dev/null 2>&1; then py3clean -p python3 diff -Nru python3-defaults-3.2.3/debian/README.Debian python3-defaults-3.4.0/debian/README.Debian --- python3-defaults-3.2.3/debian/README.Debian 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/debian/README.Debian 2013-08-03 07:34:39.000000000 +0000 @@ -1,6 +1,6 @@ More documentation and README's for this package can be found in the directory - /usr/share/doc/python3.2/ + /usr/share/doc/python3.3/ The upstream documentation can be found after installation of the python-doc package in the directory diff -Nru python3-defaults-3.2.3/debian/rules python3-defaults-3.4.0/debian/rules --- python3-defaults-3.2.3/debian/rules 2012-04-15 04:45:19.000000000 +0000 +++ python3-defaults-3.4.0/debian/rules 2014-03-22 19:52:26.000000000 +0000 @@ -6,21 +6,28 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) +include /usr/share/dpkg/architecture.mk changelog_values := $(shell dpkg-parsechangelog \ | awk '/^(Version|Source):/ {print $$2}') PKGSOURCE := $(word 1, $(changelog_values)) PKGVERSION := $(word 2, $(changelog_values)) +UPSTRVER := $(shell echo $(PKGVERSION) | sed -rne 's,(.*)-.*,\1,p') +IPKGVER := $(shell echo $(PKGVERSION) | sed -rne 's,(.*)\+.*,\1,p') +VER := $(shell echo $(PKGVERSION) | sed -rne 's,(.{3}).*,\1,p') +NVER := $(shell echo $(VER) | awk 'BEGIN{FS="." }{print $$1 "." $$2 + 1}') + distribution := $(shell lsb_release -is) -export VER=3.2 -export NVER=3.3 -export PVER=python3.2 +ifeq ($(distribution),Ubuntu) + # first Ubuntu version with Multi-Arch: allowed + UPSTRVER := 3.4.0-0~ +else + # first Debian version with Multi-Arch: allowed + UPSTRVER := 3.4.0-1~ +endif -PREVVER := $(shell awk '/^python/ && NR > 1 {print substr($$2,2,length($$2)-2); exit}' debian/changelog) -PREVVER := 3.2.3 PWD := $(shell pwd) @@ -52,14 +59,13 @@ touch stamp-doc-policy stamp-doc: #stamp-doc-policy - make -C pydist README.PyDist.html touch stamp-doc control-file: - sed -e "s/@PVER@/$(PVER)/g" \ + sed -e "s/@UPSTRVER@/$(UPSTRVER)/g" \ + -e "s/@IPKGVER@/$(IPKGVER)/g" \ -e "s/@NVER@/$(NVER)/g" \ -e "s/@VER@/$(VER)/g" \ - -e "s/@PREVVER@/$(PREVVER)/g" \ debian/control.tmp ifeq ($(distribution),Ubuntu) ifneq (,$(findstring ubuntu, $(PKGVERSION))) @@ -101,7 +107,7 @@ set -e;\ for f in debian/*.in; do \ - f2=`echo $$f | sed "s,PVER,$(PVER),g;s/VER/$(VER)/g;s,\.in$$,,"`; \ + f2=`echo $$f | sed "s,PVER,python$(VER),g;s/VER/$(VER)/g;s,\.in$$,,"`; \ if [ $$f2 != debian/control ]; then \ rm -f $$f2; \ fi; \ @@ -115,9 +121,9 @@ set -e;\ for f in debian/*.in; do \ - f2=`echo $$f | sed "s,PVER,$(PVER),g;s/VER/$(VER)/g;s,\.in$$,,"`; \ + f2=`echo $$f | sed "s,PVER,python$(VER),g;s/VER/$(VER)/g;s,\.in$$,,"`; \ if [ $$f2 != debian/control ]; then \ - sed -e "s/@PVER@/$(PVER)/g;s/@VER@/$(VER)/g" \ + sed -e "s/@PVER@/python$(VER)/g;s/@VER@/$(VER)/g" \ -e "s/@PRIORITY@/$(PRIORITY)/g" \ -e "s,@SCRIPTDIR@,/$(scriptdir),g" \ <$$f >$$f2; \ @@ -154,7 +160,7 @@ dh_installdirs #make check_versions DESTDIR=debian/python3 PREFIX=/usr make install-dev - DESTDIR=debian/python3 PREFIX=/usr make install-runtime + DESTDIR=debian/python3-minimal PREFIX=/usr make install-runtime manpages # disabled by default, run manually if you want to update it # (requires apt-file and network connection) #make dist_fallback @@ -166,15 +172,62 @@ dh_testroot -i dh_installman -i +ifeq ($(with_doc),yes) + mkdir -p debian/python3-doc/usr/share/doc/python3 + ln -sf ../python$(VER)-doc/html \ + debian/python3-doc/usr/share/doc/python3/html + mkdir -p debian/python3-doc/usr/share/doc/python3-doc + ln -sf ../python$(VER)-doc/html \ + debian/python3-doc/usr/share/doc/python3-doc/html +endif + + : # provide the idle and idle.1 defaults + mkdir -p debian/idle3/usr/bin + install -m 755 debian/idle.py debian/idle3/usr/bin/idle3 + + mkdir -p debian/idle3/usr/share/man/man1 + install -m 644 debian/idle.1 debian/idle3/usr/share/man/man1/idle3.1 + + mkdir -p debian/idle3/usr/share/pixmaps + ln -sf python3.xpm debian/idle3/usr/share/pixmaps/idle3.xpm + + mkdir -p debian/idle3/usr/share/applications + cp -p debian/idle3.desktop debian/idle3/usr/share/applications/ + +# dh_installdebconf -i $(NOPKGS) + dh_lintian -i + dh_installdocs -i $(NOPKGS) --all debian/README.Debian + dh_installmenu -i $(NOPKGS) + dh_installchangelogs -i $(NOPKGS) + + for p in examples idle3; do \ + [ $$p = idle3 ] || p=python3-$$p; \ + rm -rf debian/$$p/usr/share/doc/$$p; \ + ln -sf python3 debian/$$p/usr/share/doc/$$p; \ + done + + 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 + dh_testdir -a + dh_testroot -a + dh_installman -a + : # provide the python and python.1 defaults mkdir -p debian/python3-minimal/usr/bin ln -sf python$(VER) debian/python3-minimal/usr/bin/python3 - ln -sf python$(VER)mu debian/python3-minimal/usr/bin/python3mu + ln -sf python$(VER)m debian/python3-minimal/usr/bin/python3m mkdir -p debian/python3-minimal/usr/share/man/man1 ln -sf python$(VER).1.gz \ debian/python3-minimal/usr/share/man/man1/python3.1.gz - ln -sf python$(VER)mu.1.gz \ - debian/python3-minimal/usr/share/man/man1/python3mu.1.gz + ln -sf python$(VER)m.1.gz \ + debian/python3-minimal/usr/share/man/man1/python3m.1.gz : # mkdir -p debian/python3-minimal/usr/share/python3 @@ -185,7 +238,7 @@ debian/python3-minimal/usr/share/python3/ install -m 644 debian/py3versions.1 \ debian/python3-minimal/usr/share/man/man1/ - dh_link -ppython3 /usr/share/python3/py3versions.py /usr/bin/py3versions + dh_link -ppython3-minimal /usr/share/python3/py3versions.py /usr/bin/py3versions # mkdir debian/python-minimal/usr/share/python-central # cp -p debian/python.pycentral debian/python-minimal/usr/share/python-central/ @@ -225,15 +278,6 @@ done endif -ifeq ($(with_doc),yes) - mkdir -p debian/python3-doc/usr/share/doc/python3 - ln -sf ../python$(VER)-doc/html \ - debian/python3-doc/usr/share/doc/python3/html - mkdir -p debian/python3-doc/usr/share/doc/python3-doc - ln -sf ../python$(VER)-doc/html \ - debian/python3-doc/usr/share/doc/python3-doc/html -endif - ifeq (0,1) mkdir -p debian/python3/usr/share/apps/konsole cp -p debian/python.desktop debian/python3/usr/share/apps/konsole/ @@ -241,31 +285,41 @@ : # provide the python3-config default mkdir -p debian/python3-dev/usr/bin - ln -sf python$(VER)mu-config debian/python3-dev/usr/bin/python3mu-config + ln -sf python$(VER)m-config debian/python3-dev/usr/bin/python3m-config mkdir -p debian/python3-dev/usr/share/man/man1 - ln -sf python$(VER)mu-config.1.gz \ - debian/python3-dev/usr/share/man/man1/python3mu-config.1.gz + ln -sf python$(VER)m-config.1.gz \ + debian/python3-dev/usr/share/man/man1/python3m-config.1.gz ln -sf python$(VER)-config debian/python3-dev/usr/bin/python3-config ln -sf python$(VER)-config.1.gz \ debian/python3-dev/usr/share/man/man1/python3-config.1.gz : # provide pkgconfig defaults - mkdir -p debian/python3-dev/usr/lib/pkgconfig - ln -sf python-$(VER).pc debian/python3-dev/usr/lib/pkgconfig/python3.pc - mkdir -p debian/python3-dbg/usr/lib/pkgconfig - ln -sf python-$(VER)-dbg.pc debian/python3-dbg/usr/lib/pkgconfig/python3-dbg.pc + mkdir -p debian/python3-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig + ln -sf python-$(VER).pc debian/python3-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python3.pc + mkdir -p debian/python3-dbg/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig + ln -sf python-$(VER)-dbg.pc debian/python3-dbg/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python3-dbg.pc + +ifeq (0,1) + : # provide pyconfig.h in the non-multiarch location. + mkdir -p debian/python3-dev/usr/include/python$(VER)m + ln -sf ../$(DEB_HOST_MULTIARCH)/python$(VER)m/pyconfig.h \ + debian/python3-dev/usr/include/python$(VER)m/pyconfig.h + mkdir -p debian/python3-dbg/usr/include/python$(VER)dm + ln -sf ../$(DEB_HOST_MULTIARCH)/python$(VER)dm/pyconfig.h \ + debian/python3-dbg/usr/include/python$(VER)dm/pyconfig.h +endif : # provide the python-dbg and python-dbg.1 defaults mkdir -p debian/python3-dbg/usr/bin - ln -sf python$(VER)dmu debian/python3-dbg/usr/bin/python3dmu - ln -sf python$(VER)dmu-config debian/python3-dbg/usr/bin/python3dmu-config + ln -sf python$(VER)dm debian/python3-dbg/usr/bin/python3dm + ln -sf python$(VER)dm-config debian/python3-dbg/usr/bin/python3dm-config ln -sf python$(VER)-dbg debian/python3-dbg/usr/bin/python3-dbg ln -sf python$(VER)-dbg-config debian/python3-dbg/usr/bin/python3-dbg-config mkdir -p debian/python3-dbg/usr/share/man/man1 - ln -sf python$(VER)dmu.1.gz \ - debian/python3-dbg/usr/share/man/man1/python3dmu.1.gz - ln -sf python$(VER)dmu-config.1.gz \ - debian/python3-dbg/usr/share/man/man1/python3dmu-config.1.gz + ln -sf python$(VER)dm.1.gz \ + debian/python3-dbg/usr/share/man/man1/python3dm.1.gz + ln -sf python$(VER)dm-config.1.gz \ + debian/python3-dbg/usr/share/man/man1/python3dm-config.1.gz ln -sf python$(VER)-dbg.1.gz \ debian/python3-dbg/usr/share/man/man1/python3-dbg.1.gz ln -sf python$(VER)-dbg-config.1.gz \ @@ -280,41 +334,70 @@ cp -p debian/valgrind-python.supp \ debian/python3/usr/lib/valgrind/python3.supp - : # provide the idle and idle.1 defaults - mkdir -p debian/idle3/usr/bin - install -m 755 debian/idle.py debian/idle3/usr/bin/idle3 - - mkdir -p debian/idle3/usr/share/man/man1 - install -m 644 debian/idle.1 debian/idle3/usr/share/man/man1/idle3.1 - - mkdir -p debian/idle3/usr/share/pixmaps - ln -sf python3.xpm debian/idle3/usr/share/pixmaps/idle3.xpm + : # provide the DEB_HOST_GNU_TYPE/DEB_HOST_MULTIRACH python-config defaults + mkdir -p debian/libpython3-dev/usr/bin + ln -sf $(DEB_HOST_MULTIARCH)-python$(VER)m-config \ + debian/libpython3-dev/usr/bin/$(DEB_HOST_MULTIARCH)-python3m-config + ln -sf $(DEB_HOST_MULTIARCH)-python$(VER)-config \ + debian/libpython3-dev/usr/bin/$(DEB_HOST_MULTIARCH)-python3-config + mkdir -p debian/libpython3-dev/usr/share/man/man1 + ln -sf $(DEB_HOST_MULTIARCH)-python$(VER)m-config.1.gz \ + debian/libpython3-dev/usr/share/man/man1/$(DEB_HOST_MULTIARCH)-python3m-config.1.gz + ln -sf $(DEB_HOST_MULTIARCH)-python$(VER)-config.1.gz \ + debian/libpython3-dev/usr/share/man/man1/$(DEB_HOST_MULTIARCH)-python3-config.1.gz +ifneq ($(DEB_HOST_MULTIARCH),$(DEB_HOST_GNU_TYPE)) + ln -sf $(DEB_HOST_GNU_TYPE)-python$(VER)m-config \ + debian/libpython3-dev/usr/bin/$(DEB_HOST_GNU_TYPE)-python3m-config + ln -sf $(DEB_HOST_GNU_TYPE)-python$(VER)-config \ + debian/libpython3-dev/usr/bin/$(DEB_HOST_GNU_TYPE)-python3-config + ln -sf $(DEB_HOST_GNU_TYPE)-python$(VER)m-config.1.gz \ + debian/libpython3-dev/usr/share/man/man1/$(DEB_HOST_GNU_TYPE)-python3m-config.1.gz + ln -sf $(DEB_HOST_GNU_TYPE)-python$(VER)-config.1.gz \ + debian/libpython3-dev/usr/share/man/man1/$(DEB_HOST_GNU_TYPE)-python3-config.1.gz +endif - mkdir -p debian/idle3/usr/share/applications - cp -p debian/idle3.desktop debian/idle3/usr/share/applications/ + mkdir -p debian/libpython3-dbg/usr/bin + ln -sf $(DEB_HOST_MULTIARCH)-python$(VER)dm-config \ + debian/libpython3-dbg/usr/bin/$(DEB_HOST_MULTIARCH)-python3dm-config + ln -sf $(DEB_HOST_MULTIARCH)-python$(VER)-dbg-config \ + debian/libpython3-dbg/usr/bin/$(DEB_HOST_MULTIARCH)-python3-dbg-config + mkdir -p debian/libpython3-dbg/usr/share/man/man1 + ln -sf $(DEB_HOST_MULTIARCH)-python$(VER)dm-config.1.gz \ + debian/libpython3-dbg/usr/share/man/man1/$(DEB_HOST_MULTIARCH)-python3dm-config.1.gz + ln -sf $(DEB_HOST_MULTIARCH)-python$(VER)-dbg-config.1.gz \ + debian/libpython3-dbg/usr/share/man/man1/$(DEB_HOST_MULTIARCH)-python3-dbg-config.1.gz +ifneq ($(DEB_HOST_MULTIARCH),$(DEB_HOST_GNU_TYPE)) + ln -sf $(DEB_HOST_GNU_TYPE)-python$(VER)dm-config \ + debian/libpython3-dbg/usr/bin/$(DEB_HOST_GNU_TYPE)-python3dm-config + ln -sf $(DEB_HOST_GNU_TYPE)-python$(VER)-dbg-config \ + debian/libpython3-dbg/usr/bin/$(DEB_HOST_GNU_TYPE)-python3-dbg-config + ln -sf $(DEB_HOST_GNU_TYPE)-python$(VER)dm-config.1.gz \ + debian/libpython3-dbg/usr/share/man/man1/$(DEB_HOST_GNU_TYPE)-python3dm-config.1.gz + ln -sf $(DEB_HOST_GNU_TYPE)-python$(VER)-dbg-config.1.gz \ + debian/libpython3-dbg/usr/share/man/man1/$(DEB_HOST_GNU_TYPE)-python3-dbg-config.1.gz +endif -# dh_installdebconf -i $(NOPKGS) - dh_lintian -i - dh_installdocs -i $(NOPKGS) --all debian/README.Debian - dh_installmenu -i $(NOPKGS) - dh_installchangelogs -i $(NOPKGS) + dh_lintian -a + dh_installdocs -a $(NOPKGS) --all debian/README.Debian + dh_installmenu -a $(NOPKGS) + dh_installchangelogs -a $(NOPKGS) - for p in all all-dev all-dbg dbg dev examples idle3; do \ + for p in all all-dev all-dbg dbg dev; do \ [ $$p = idle3 ] || p=python3-$$p; \ rm -rf debian/$$p/usr/share/doc/$$p; \ ln -sf python3 debian/$$p/usr/share/doc/$$p; \ done - - 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 -# nothing to do + rm -rf debian/libpython3-all-dev/usr/share/doc/libpython3-all-dev + ln -sf libpython3-dev debian/libpython3-all-dev/usr/share/doc/libpython3-all-dev + rm -rf debian/libpython3-all-dbg/usr/share/doc/libpython3-all-dbg + ln -sf libpython3-dbg debian/libpython3-all-dbg/usr/share/doc/libpython3-all-dbg + + dh_compress -a $(NOPKGS) + dh_fixperms -a $(NOPKGS) + dh_installdeb -a $(NOPKGS) + dh_gencontrol -a $(NOPKGS) + dh_md5sums -a $(NOPKGS) + dh_builddeb -a $(NOPKGS) binary: binary-indep binary-arch diff -Nru python3-defaults-3.2.3/debian/source/format python3-defaults-3.4.0/debian/source/format --- python3-defaults-3.2.3/debian/source/format 1970-01-01 00:00:00.000000000 +0000 +++ python3-defaults-3.4.0/debian/source/format 2013-08-03 07:34:39.000000000 +0000 @@ -0,0 +1 @@ +1.0 diff -Nru python3-defaults-3.2.3/debpython/debhelper.py python3-defaults-3.4.0/debpython/debhelper.py --- python3-defaults-3.2.3/debpython/debhelper.py 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/debpython/debhelper.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,192 +0,0 @@ -# -*- coding: UTF-8 -*- -# Copyright © 2010-2012 Piotr Ożarowski -# -# 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 logging -from os import makedirs, chmod -from os.path import exists, join, dirname - -log = logging.getLogger(__name__) - - -class DebHelper: - """Reinvents the wheel / some dh functionality (Perl is ugly ;-P)""" - - def __init__(self, packages=None, no_packages=None): - self.packages = {} - self.python_version = None - source_section = True - binary_package = None - - fp = open('debian/control', 'r', encoding='utf-8') - - for line in fp: - if not line.strip(): - source_section = False - binary_package = None - continue - if binary_package: - if binary_package.startswith('python-') or\ - binary_package.startswith('python2'): - continue - if packages and binary_package not in packages: - continue - if no_packages and binary_package in no_packages: - continue - if line.startswith('Architecture:'): - arch = line[13:].strip() - # TODO: if arch doesn't match current architecture: - #del self.packages[binary_package] - self.packages[binary_package]['arch'] = arch - continue - elif line.startswith('Package:'): - binary_package = line[8:].strip() - if binary_package.startswith('python-') or\ - binary_package.startswith('python2'): - log.debug('skipping Python 2.X package: %s', binary_package) - continue - if packages and binary_package not in packages: - continue - if no_packages and binary_package in no_packages: - continue - self.packages[binary_package] = {'substvars': {}, - 'autoscripts': {}, - 'rtupdates': []} - elif line.startswith('Source:'): - self.source_name = line[7:].strip() - elif source_section and line.startswith('X-Python3-Version:'): - self.python_version = line[18:] - elif source_section and line.startswith('XS-Python-Version:')\ - and not self.python_version: - self.python_version = line[18:] - fp.close() - log.debug('source=%s, binary packages=%s', self.source_name,\ - list(self.packages.keys())) - - def addsubstvar(self, package, name, value): - """debhelper's addsubstvar""" - self.packages[package]['substvars'].setdefault(name, []).append(value) - - def autoscript(self, package, when, template, args): - """debhelper's autoscript""" - self.packages[package]['autoscripts'].setdefault(when, {})\ - .setdefault(template, []).append(args) - - def add_rtupdate(self, package, value): - self.packages[package]['rtupdates'].append(value) - - def save_autoscripts(self): - for package, settings in self.packages.items(): - autoscripts = settings.get('autoscripts') - if not autoscripts: - continue - - for when, templates in autoscripts.items(): - fn = "debian/%s.%s.debhelper" % (package, when) - if exists(fn): - data = open(fn, 'r').read() - else: - data = '' - - new_data = '' - for tpl_name, args in templates.items(): - for i in args: - # try local one first (useful while testing dh_python3) - fpath = join(dirname(__file__), '..', - "autoscripts/%s" % tpl_name) - if not exists(fpath): - fpath = "/usr/share/debhelper/autoscripts/%s" % tpl_name - tpl = open(fpath, 'r').read() - tpl = tpl.replace('#PACKAGE#', package) - tpl = tpl.replace('#ARGS#', i) - if tpl not in data and tpl not in new_data: - new_data += "\n%s" % tpl - if new_data: - data += "\n# Automatically added by dh_python3:" +\ - "%s\n# End automatically added section\n" % new_data - fp = open(fn, 'w') - fp.write(data) - fp.close() - - def save_substvars(self): - for package, settings in self.packages.items(): - substvars = settings.get('substvars') - if not substvars: - continue - fn = "debian/%s.substvars" % package - if exists(fn): - data = open(fn, 'r').read() - else: - data = '' - for name, values in substvars.items(): - p = data.find("%s=" % name) - if p > -1: # parse the line and remove it from data - e = data[p:].find('\n') - line = data[p + len("%s=" % name):\ - p + e if e > -1 else None] - items = [i.strip() for i in line.split(',') if i] - if e > -1 and data[p + e:].strip(): - data = "%s\n%s" % (data[:p], data[p + e:]) - else: - data = data[:p] - else: - items = [] - for j in values: - if j not in items: - items.append(j) - if items: - if data: - data += '\n' - data += "%s=%s\n" % (name, ', '.join(items)) - data = data.replace('\n\n', '\n') - if data: - fp = open(fn, 'w') - fp.write(data) - fp.close() - - def save_rtupdate(self): - for package, settings in self.packages.items(): - values = settings.get('rtupdates') - if not values: - continue - d = "debian/%s/usr/share/python3/runtime.d" % package - if not exists(d): - makedirs(d) - fn = "%s/%s.rtupdate" % (d, package) - if exists(fn): - data = open(fn, 'r').read() - else: - data = "#! /bin/sh\nset -e" - for dname, args in values: - cmd = 'if [ "$1" = rtupdate ]; then' +\ - "\n\tpy3clean %s" % dname +\ - "\n\tpy3compile %s %s\nfi" % (args, dname) - if cmd not in data: - data += "\n%s" % cmd - if data: - fp = open(fn, 'w') - fp.write(data) - fp.close() - chmod(fn, 0o755) - - def save(self): - self.save_substvars() - self.save_autoscripts() - self.save_rtupdate() diff -Nru python3-defaults-3.2.3/debpython/depends.py python3-defaults-3.4.0/debpython/depends.py --- python3-defaults-3.2.3/debpython/depends.py 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/debpython/depends.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,178 +0,0 @@ -# Copyright © 2010 Piotr Ożarowski -# -# 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 logging -from debpython.pydist import parse_pydep, guess_dependency -from debpython.version import DEFAULT, vrepr, vrange_str - -# minimum version required for py3compile/py3clean: -MINPYCDEP = 'python3 (>= 3.1.3-13~)' - -log = logging.getLogger(__name__) - - -class Dependencies: - """Store relations (dependencies, etc.) between packages.""" - - def __init__(self, package): - self.package = package - self.depends = [] - self.recommends = [] - self.suggests = [] - self.enhances = [] - self.breaks = [] - self.rtscripts = [] - - def export_to(self, dh): - """Fill in debhelper's substvars.""" - for i in self.depends: - dh.addsubstvar(self.package, 'python3:Depends', i) - for i in self.recommends: - dh.addsubstvar(self.package, 'python3:Recommends', i) - for i in self.suggests: - dh.addsubstvar(self.package, 'python3:Suggests', i) - for i in self.enhances: - dh.addsubstvar(self.package, 'python3:Enhances', i) - for i in self.breaks: - dh.addsubstvar(self.package, 'python3:Breaks', i) - for i in self.rtscripts: - dh.add_rtupdate(self.package, i) - - def __str__(self): - return "D=%s; R=%s; S=%s; E=%s, B=%s; RT=%s" % (self.depends, \ - self.recommends, self.suggests, self.enhances, \ - self.breaks, self.rtscripts) - - def depend(self, value): - if value and value not in self.depends: - self.depends.append(value) - - def recommend(self, value): - if value and value not in self.recommends: - self.recommends.append(value) - - def suggest(self, value): - if value and value not in self.suggests: - self.suggests.append(value) - - def enhance(self, value): - if value and value not in self.enhances: - self.enhances.append(value) - - def break_(self, value): - if value and value not in self.breaks: - self.breaks.append(value) - - def rtscript(self, value): - if value not in self.rtscripts: - self.rtscripts.append(value) - - def parse(self, stats, options): - log.debug('generating dependencies for package %s', self.package) - - if options.vrange: - maxv = None - dbgpkg = self.package.endswith('-dbg') - tpl = 'python3-dbg' if dbgpkg else 'python3' - # additional Depends to block python3 package transitions - minv = options.vrange[0] - if len(options.vrange) > 1: - maxv = options.vrange[-1] - if minv: - self.depend("%s (>= %d.%d)" % \ - (tpl, minv[0], minv[1])) - if maxv: - self.depend("%s (<< %d.%d)" % \ - (tpl, maxv[0], maxv[1])) - - if stats['ext']: - # TODO: what about extensions with stable ABI? - dbgpkg = self.package.endswith('-dbg') - tpl = 'python3-dbg' if dbgpkg else 'python3' - # additional Depends to block python3 package transitions - sorted_vers = sorted(stats['ext']) - minv = sorted_vers[0] - maxv = sorted_vers[-1] - if minv <= DEFAULT: - self.depend("%s (>= %d.%d)" % \ - (tpl, minv[0], minv[1])) - if maxv >= DEFAULT: - self.depend("%s (<< %d.%d)" % \ - (tpl, maxv[0], maxv[1] + 1)) - - # make sure py3compile binary is available - if stats['compile']: - self.depend(MINPYCDEP) - - for interpreter, version in stats['shebangs']: - self.depend(interpreter) - - for private_dir, details in stats['private_dirs'].items(): - versions = list(v for i, v in details.get('shebangs', []) if v) - if len(versions) > 1: - log.error('more than one Python dependency from shebangs' - '(%s shebang versions: %s)', private_dir, versions) - exit(13) - elif len(versions) == 1: # one hardcoded version - self.depend("python%d.%d" % versions[0]) - # TODO: if versions[0] not in requested_versions: FTBFS - elif details.get('compile', False): - # no hardcoded versions, but there's something to compile - self.depend(MINPYCDEP) - args = '' - if details.get('ext', False): - # use smallest and largest version to set range - extensions = sorted(details['ext']) - vr = (extensions[0], extensions[-1]) - else: # no extension - vr = options.vrange - if vr: - args += "-V %s" % vrange_str(vr) - if details.get('ext', False): - self.depend('|'.join("python%s" %\ - vrepr(i) for i in details['ext'])) - else: # pure modules only - if vr[0]: # minimum version specified - self.depend("python3 (>= %s)" % vrepr(vr[0])) - if vr[1]: # maximum version specified - self.depend("python3 (<< %s)" % vrepr(vr[1])) - - for pattern in options.regexpr or []: - args += " -X '%s'" % pattern.replace("'", r"\'") - self.rtscript((private_dir, args)) - - if options.guess_deps: - for fn in stats['requires.txt']: - # TODO: should options.recommends and options.suggests be - # removed from requires.txt? - for i in parse_pydep(fn): - self.depend(i) - - # add dependencies from --depends - for item in options.depends or []: - self.depend(guess_dependency(item)) - # add dependencies from --recommends - for item in options.recommends or []: - self.recommend(guess_dependency(item)) - # add dependencies from --suggests - for item in options.suggests or []: - self.suggest(guess_dependency(item)) - - log.debug(self) diff -Nru python3-defaults-3.2.3/debpython/files.py python3-defaults-3.4.0/debpython/files.py --- python3-defaults-3.2.3/debpython/files.py 1970-01-01 00:00:00.000000000 +0000 +++ python3-defaults-3.4.0/debpython/files.py 2013-08-03 07:34:39.000000000 +0000 @@ -0,0 +1,84 @@ +# Copyright © 2012 Piotr Ożarowski +# +# 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 logging +from os import walk +from os.path import abspath, isfile, join +from subprocess import Popen, PIPE +from debpython import PUBLIC_DIR_RE + +log = logging.getLogger(__name__) + + +def from_directory(dname, extensions=('.py',)): + """Generate *.py file names available in given directory.""" + extensions = tuple(extensions) # .endswith doesn't like list + if isinstance(dname, (list, tuple)): + for item in dname: + for fn in from_directory(item): + yield fn + elif isfile(dname) and dname.endswith(extensions): + yield dname + else: + for root, dirs, file_names in walk(abspath(dname)): + for fn in file_names: + if fn.endswith(extensions): + yield join(root, fn) + + +def from_package(package_name, extensions=('.py',)): + """Generate *.py file names available in given package.""" + extensions = tuple(extensions) # .endswith doesn't like list + process = Popen("/usr/bin/dpkg -L %s" % package_name, + shell=True, stdout=PIPE) + stdout, stderr = process.communicate() + if process.returncode != 0: + raise Exception("cannot get content of %s" % package_name) + stdout = str(stdout, 'utf-8') + for line in stdout.splitlines(): + if line.endswith(extensions): + yield line + + +def filter_directory(files, dname): + """Generate *.py file names that match given directory.""" + for fn in files: + if fn.startswith(dname): + yield fn + + +def filter_public(files, versions): + """Generate *.py file names that match given versions.""" + vstr = set("%d.%d" % i for i in versions) + shared_vstr = set(str(i[0]) for i in versions) + for fn in files: + public_dir = PUBLIC_DIR_RE.match(fn) + if public_dir: + vers = public_dir.group(1) + if vers in shared_vstr or vers in vstr: + yield fn + + +def filter_out_ext(files, extensions): + """Removes files with matching extensions from given generator.""" + extensions = tuple(extensions) # .endswith doesn't like list + for fn in files: + if not fn.endswith(extensions): + yield fn diff -Nru python3-defaults-3.2.3/debpython/__init__.py python3-defaults-3.4.0/debpython/__init__.py --- python3-defaults-3.2.3/debpython/__init__.py 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/debpython/__init__.py 2013-08-03 07:34:39.000000000 +0000 @@ -0,0 +1,58 @@ +try: + from datetime import datetime +except ImportError: + datetime = None +import logging +import re +from subprocess import PIPE, Popen +from pickle import dumps + +log = logging.getLogger(__name__) +PUBLIC_DIR_RE = re.compile(r'.*?/usr/lib/python(\d(?:.\d+)?)/(site|dist)-packages') + + +class memoize: + def __init__(self, func): + self.func = func + self.cache = {} + + def __call__(self, *args, **kwargs): + key = dumps((args, kwargs)) + if key not in self.cache: + self.cache[key] = self.func(*args, **kwargs) + return self.cache[key] + + +def execute(command, cwd=None, env=None, log_output=None): + """Execute external shell commad. + + :param cdw: currennt working directory + :param env: environment + :param log_output: + * opened log file or path to this file, or + * None if output should be included in the returned dict, or + * False if output should be redirectored to stdout/stderr + """ + args = {'shell': True, 'cwd': cwd, 'env': env} + close = False + if log_output is False: + pass + elif log_output is None: + args.update(stdout=PIPE, stderr=PIPE) + elif log_output: + if isinstance(log_output, str): + close = True + log_output = open(log_output, 'a') + if datetime: + log_output.write('\n# command executed on {}'.format(datetime.now().isoformat())) + log_output.write('\n$ {}\n'.format(command)) + log_output.flush() + args.update(stdout=log_output, stderr=log_output) + + log.debug('invoking: %s', command) + with Popen(command, **args) as process: + stdout, stderr = process.communicate() + close and log_output.close() + return dict(returncode=process.returncode, + stdout=stdout and str(stdout, 'utf-8'), + stderr=stderr and str(stderr, 'utf-8')) diff -Nru python3-defaults-3.2.3/debpython/interpreter.py python3-defaults-3.4.0/debpython/interpreter.py --- python3-defaults-3.2.3/debpython/interpreter.py 1970-01-01 00:00:00.000000000 +0000 +++ python3-defaults-3.4.0/debpython/interpreter.py 2013-08-03 07:34:39.000000000 +0000 @@ -0,0 +1,369 @@ +# Copyright © 2012 Piotr Ożarowski +# +# 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 logging +import os +import re +from os.path import join, split +from debpython import execute +from debpython.version import Version + +SHEBANG_RE = re.compile(r''' + (?:\#!\s*){0,1} # shebang prefix + (?P + .*?/bin/.*?)? + (?P + python|pypy) + (?P + \d[\.\d]*)? + (?P + -dbg)? + (?P.*) + ''', re.VERBOSE) +EXTFILE_RE = re.compile(r''' + (?P.*?) + (?:\. + (?Pabi\d+) + |(?:\. + (?P + (?Pcpython|pypy) + - + (?P\d{2}) + (?P[a-z]*?) + ) + (?: + -(?P[^/]*?) + )? + ))? + (?P_d)? + \.so$''', re.VERBOSE) +log = logging.getLogger(__name__) + + +class Interpreter: + path = None + name = 'python' + version = None + debug = False + impl = 'cpython' # implementation + options = () + _cache = {} + + def __init__(self, value=None, path=None, name=None, version=None, + debug=None, impl=None, options=None): + params = locals() + del params['self'] + del params['value'] + + if isinstance(value, Interpreter): + for key in params.keys(): + if params[key] is None: + params[key] = getattr(value, key) + elif value: + if value.replace('.', '').isdigit() and not version: + params['version'] = Version(value) + else: + for key, val in self.parse(value).items(): + if params[key] is None: + params[key] = val + + for key, val in params.items(): + setattr(self, key, val) + + def __setattr__(self, name, value): + if name == 'name' and value: + if value.startswith('python'): + self.__dict__['impl'] = 'cpython' + elif value.startswith('pypy'): + self.__dict__['impl'] = 'pypy' + if '-dbg' in value: + self.__dict__['debug'] = True + elif name == 'version' and value is not None: + value = Version(value) + if name in ('name', 'impl', 'debug', 'options') and value is None: + # get the class default instead + self.__dict__[name] = getattr(Interpreter, name) + else: + self.__dict__[name] = value + + def __repr__(self): + result = self.path or '' + result += self._vstr(self.version) + if self.options: + result += ' ' + ' '.join(self.options) + return result + + def __str__(self): + return self._vstr(self.version) + + def _vstr(self, version): + if self.impl == 'pypy': + # TODO: will Debian support more than one PyPy version? + return self.name + if version and str(version) not in self.name: + if self.debug: + return 'python{}-dbg'.format(version) + return self.name + str(version) + return self.name + + @staticmethod + def parse(shebang): + """Return dict with parsed shebang + + >>> sorted(Interpreter.parse('pypy').items()) + [('debug', None), ('name', 'pypy'), ('options', ()), ('path', None), ('version', None)] + >>> sorted(Interpreter.parse('/usr/bin/python3.3-dbg').items()) + [('debug', '-dbg'), ('name', 'python'), ('options', ()), ('path', '/usr/bin/'), ('version', '3.3')] + >>> sorted(Interpreter.parse('#! /usr/bin/pypy --foo').items()) + [('debug', None), ('name', 'pypy'), ('options', ('--foo',)), ('path', '/usr/bin/'), ('version', None)] + >>> sorted(Interpreter.parse('#! /usr/bin/python3.2').items()) + [('debug', None), ('name', 'python'), ('options', ()), ('path', '/usr/bin/'), ('version', '3.2')] + >>> sorted(Interpreter.parse('/usr/bin/python3.2-dbg --foo --bar').items()) + [('debug', '-dbg'), ('name', 'python'), ('options', ('--foo', '--bar')),\ + ('path', '/usr/bin/'), ('version', '3.2')] + """ + result = SHEBANG_RE.search(shebang) + if not result: + return {} + result = result.groupdict() + if 'options' in result: + # TODO: do we need "--key value" here? + result['options'] = tuple(result['options'].split()) + return result + + def sitedir(self, gdb=False, package=None, version=None): + """Return path to site-packages directory. + + Note that returned path is not the final location of .py files + + >>> i = Interpreter('python') + >>> i.sitedir(version='3.1') + '/usr/lib/python3/dist-packages/' + >>> i.sitedir(version='2.5') + '/usr/lib/python2.5/site-packages/' + >>> i.sitedir(version=Version('2.7')) + '/usr/lib/python2.7/dist-packages/' + >>> i.sitedir(version='3.1', gdb=True, package='python3-foo') + 'debian/python3-foo/usr/lib/debug/usr/lib/python3/dist-packages/' + >>> i.sitedir(version=Version('3.2')) + '/usr/lib/python3/dist-packages/' + >>> Interpreter('pypy').sitedir(version='2.0') + '/usr/lib/pypy/dist-packages/' + """ + version = Version(version or self.version) + #if not version: + # version = Version(DEFAULT) + if self.impl == 'pypy': + path = '/usr/lib/pypy/dist-packages/' + elif version << Version('2.6'): + path = "/usr/lib/python%s/site-packages/" % version + elif version << Version('3.0'): + path = "/usr/lib/python%s/dist-packages/" % version + else: + path = '/usr/lib/python3/dist-packages/' + + if gdb: + path = "/usr/lib/debug%s" % path + if package: + path = "debian/%s%s" % (package, path) + + return path + + def cache_file(self, fpath, version=None): + """Given path to a .py file, return path to its .pyc/.pyo file. + + This function is inspired by Python 3.2's imp.cache_from_source. + + :param fpath: path to file name + :param version: Python version + + >>> i = Interpreter('python') + >>> i.cache_file('foo.py', Version('3.1')) + 'foo.pyc' + >>> i.cache_file('bar/foo.py', '3.2') + 'bar/__pycache__/foo.cpython-32.pyc' + """ + version = Version(version or self.version) + last_char = 'o' if '-O' in self.options else 'c' + if version <= Version('3.1'): + return fpath + last_char + + fdir, fname = split(fpath) + if not fname.endswith('.py'): + fname += '.py' + return join(fdir, '__pycache__', "%s.%s.py%s" % + (fname[:-3], self.magic_tag(version), last_char)) + + def ext_file(self, name, version=None): + """Return extension name with soname and multiarch tags.""" + version = Version(version or self.version) + soabi, multiarch = self._get_config(version) + result = name.split('.', 1)[0] + if soabi: + result += '.{}'.format(soabi) + if multiarch: + result += '-{}'.format(multiarch) + if self.debug and self.impl == 'cpython'\ + and version << Version('3'): + result += '_d' + return '{}.so'.format(result) + + def magic_number(self, version=None): + """Return magic number.""" + version = Version(version or self.version) + if self.impl == 'cpython' and version << Version('3'): + return '' + result = self._execute('import imp; print(imp.get_magic())', version) + return eval(result) + + def magic_tag(self, version=None): + """Return Python magic tag (used in __pycache__ dir to tag files). + + >>> i = Interpreter('python') + >>> i.magic_tag(version='3.2') + 'cpython-32' + """ + version = Version(version or self.version) + if self.impl == 'cpython' and version << Version('3.2'): + return '' + return self._execute('import imp; print(imp.get_tag())', version) + + def multiarch(self, version=None): + """Return multiarch tag.""" + version = Version(version or self.version) + try: + soabi, multiarch = self._get_config(version) + except Exception: + log.debug('cannot get multiarch', exc_info=True) + # interpreter without multiach support + return '' + return multiarch + + def stableabi(self, version=None): + version = Version(version or self.version) + # stable ABI was introduced in Python 3.3 + if self.impl == 'cpython' and version >> Version('3.2'): + return 'abi{}'.format(version.major) + + def soabi(self, version=None): + """Return SOABI flag (used to in .so files). + + >>> i = Interpreter('python') + >>> i.soabi(version=Version('3.3')) + 'cpython-33m' + """ + version = Version(version or self.version) + # NOTE: it's not the same as magic_tag + try: + soabi, multiarch = self._get_config(version) + except Exception: + log.debug('cannot get soabi', exc_info=True) + # interpreter without soabi support + return '' + return soabi + + def check_extname(self, fname, version=None): + """Return extension file name if file can be renamed. + + >>> i = Interpreter('python') + >>> i.check_extname('foo.so', version='3.3') # doctest: +ELLIPSIS + 'foo.cpython-33m-....so' + >>> i.check_extname('foo.abi3.so', version='3.3') + >>> i.check_extname('foo/bar/bazmodule.so', version='3.3') # doctest: +ELLIPSIS + 'foo/bar/baz.cpython-33m-....so' + """ + version = Version(version or self.version) + + if '/' in fname: + fdir, fname = fname.rsplit('/', 1) # in case full path was passed + else: + fdir = '' + + info = EXTFILE_RE.search(fname) + if not info: + return + info = info.groupdict() + + if info['stableabi']: + # files with stable ABI in name don't need changes + return + + i = Interpreter(self, version=version) + if info['ver']: + i.version = "{}.{}".format(info['ver'][0], info['ver'][1]) + if not i.debug and (info['debug'] or 'd' in (info['flags'] or '')): + i.debug = True + try: + soabi, multiarch = i._get_config() + except Exception: + log.debug('cannot get soabi/multiarch', exc_info=True) + return + result = info['name'] + if i.impl == 'cpython' and i.version >> '3.2' and result.endswith('module'): + result = result[:-6] + if info['soabi'] or soabi: + result = "{}.{}".format(result, info['soabi'] or soabi) + if info['multiarch'] or multiarch: + result = "{}-{}".format(result, info['multiarch'] or multiarch) + + result += '.so' + if fname == result: + return + return join(fdir, result) + + def _get_config(self, version=None): + version = Version(version or self.version) + # sysconfig module is available since Python 3.2 + # (also backported to Python 2.7) + if self.impl == 'pypy' or self.impl == 'cpython' and ( + version >> '2.6' and version << '3' + or version >> '3.1' or version == '3'): + cmd = 'import sysconfig as s;' + else: + cmd = 'from distutils import sysconfig as s;' + cmd += 'print("__SEP__".join(i or "" ' \ + 'for i in s.get_config_vars("SOABI", "MULTIARCH")))' + conf_vars = self._execute(cmd, version).split('__SEP__') + try: + conf_vars[1] = os.environ['DEB_HOST_MULTIARCH'] + except KeyError: + pass + return conf_vars + + def _execute(self, command, version=None, cache=True): + version = Version(version or self.version) + command = "{} -c '{}'".format(self._vstr(version), command.replace("'", "\'")) + if cache and command in self.__class__._cache: + return self.__class__._cache[command] + + output = execute(command) + if output['returncode'] != 0: + log.debug(output['stderr']) + raise Exception('{} failed with status code {}'.format(command, output['returncode'])) + + result = output['stdout'].splitlines() + + if len(result) == 1: + result = result[0] + + if cache: + self.__class__._cache[command] = result + + return result diff -Nru python3-defaults-3.2.3/debpython/option.py python3-defaults-3.4.0/debpython/option.py --- python3-defaults-3.2.3/debpython/option.py 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/debpython/option.py 2012-12-03 21:49:53.000000000 +0000 @@ -1,5 +1,5 @@ # -*- coding: UTF-8 -*- -# Copyright © 2010 Piotr Ożarowski +# Copyright © 2010-2012 Piotr Ożarowski # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -35,7 +35,7 @@ def compile_regexpr(option, opt, value): try: pattern = re.compile(value) - except: + except Exception: raise optparse.OptionValueError('regular expression is not valid') return pattern diff -Nru python3-defaults-3.2.3/debpython/pydist.py python3-defaults-3.4.0/debpython/pydist.py --- python3-defaults-3.2.3/debpython/pydist.py 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/debpython/pydist.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,212 +0,0 @@ -# Copyright © 2010 Piotr Ożarowski -# -# 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 logging -import os -import re -from os.path import exists, isdir, join -from subprocess import PIPE, Popen -from debpython.version import vrepr, getver, get_requested_versions -from debpython.tools import memoize - -log = logging.getLogger(__name__) - -PUBLIC_DIR_RE = re.compile(r'.*?/usr/lib/python(\d(?:.\d+)?)/(site|dist)-packages') -PYDIST_RE = re.compile(r""" - (?P[A-Za-z][A-Za-z0-9_.]*) # Python distribution name - \s* - (?P(?:-?\d\.\d+(?:-(?:\d\.\d+)?)?)?) # version range - \s* - (?P(?:[a-z][^;]*)?) # Debian dependency - (?: # optional upstream version -> Debian version translator - ;\s* - (?PPEP386)? # PEP-386 mode - \s* - (?Ps/.*)? # translator rules - )? - """, re.VERBOSE) -REQUIRES_RE = re.compile(r''' - (?P[A-Za-z][A-Za-z0-9_.]*) # Python distribution name - \s* - (?P(?:\[[^\]]*\])?) # ignored for now - \s* - (?: # optional minimum/maximum version - (?P<=?|>=?|==|!=) - \s* - (?P(\w|[-.])+) - )? - ''', re.VERBOSE) - - -def validate(fpath, exit_on_error=False): - """Check if pydist file looks good.""" - with open(fpath) as fp: - for line in fp: - line = line.strip('\r\n') - if line.startswith('#') or not line: - continue - if not PYDIST_RE.match(line): - log.error('invalid pydist data in file %s: %s', \ - fpath.rsplit('/', 1)[-1], line) - if exit_on_error: - exit(3) - return False - return True - - -@memoize -def load(dname='/usr/share/python3/dist/', fname='debian/py3dist-overrides', - fbname='/usr/share/python3/dist_fallback'): - """Load iformation about installed Python distributions.""" - if exists(fname): - to_check = [fname] # first one! - else: - 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: - with open(fpath) as fp: - for line in fp: - line = line.strip('\r\n') - if line.startswith('#') or not line: - continue - dist = PYDIST_RE.search(line) - if not dist: - log.error('%s file has a broken line: %s', fpath, line) - exit(9) - dist = dist.groupdict() - name = safe_name(dist['name']) - dist['versions'] = get_requested_versions(dist['vrange']) - dist['dependency'] = dist['dependency'].strip() - if dist['rules']: - dist['rules'] = dist['rules'].split(';') - else: - dist['rules'] = [] - result.setdefault(name, []).append(dist) - return result - - -def guess_dependency(req, version=None): - log.debug('trying to guess dependency for %s (python=%s)', - req, vrepr(version) if version else None) - if isinstance(version, str): - version = getver(version) - - # some upstreams have weird ideas for distribution name... - name, rest = re.compile('([^><= ]+)(.*)').match(req).groups() - req = safe_name(name) + rest - - data = load() - req_dict = REQUIRES_RE.match(req) - if not req_dict: - log.error('requirement is not valid: %s', req) - log.info('please ask dh_python3 author to fix REQUIRES_RE ' - 'or your upstream author to fix requires.txt') - exit(8) - req_dict = req_dict.groupdict() - details = data.get(req_dict['name'].lower()) - if details: - for item in details: - if version and version not in item.get('versions', version): - # rule doesn't match version, try next one - continue - - if not item['dependency']: - return # this requirement should be ignored - if item['dependency'].endswith(')'): - # no need to translate versions if version is hardcoded in Debian - # dependency - return item['dependency'] - if req_dict['version']: - # FIXME: translate it (rules, versions) - return item['dependency'] - else: - return item['dependency'] - - # try dpkg -S - query = "'*python3/*/%s-?*\.egg-info'" % ci_regexp(safe_name(name)) # TODO: .dist-info - - log.debug("invoking dpkg -S %s", query) - process = Popen("/usr/bin/dpkg -S %s" % query, \ - shell=True, stdout=PIPE) - stdout, stderr = process.communicate() - if process.returncode == 0: - result = set() - stdout = str(stdout, 'utf-8') - for line in stdout.split('\n'): - if not line.strip(): - continue - result.add(line.split(':')[0]) - if len(result) > 1: - log.error('more than one package name found for %s dist', name) - else: - return result.pop() - - # fall back to python-distname - pname = sensible_pname(name) - log.warn('Cannot find package that provides %s. ' - 'Using %s as package name. Please add "%s correct_package_name" ' - 'line to debian/pydist-overrides to override it.', - name, pname, name) - return pname - - -def parse_pydep(fname): - public_dir = PUBLIC_DIR_RE.match(fname) - if public_dir and len(public_dir.group(1)) != 1: - ver = public_dir.group(1) - else: - ver = None - - result = [] - with open(fname, 'r', encoding='utf-8') as fp: - for line in fp: - line = line.strip() - # ignore all optional sections - if line.startswith('['): - break - if line: - dependency = guess_dependency(line, ver) - if dependency: - result.append(dependency) - return result - - -def safe_name(name): - """Emulate distribute's safe_name.""" - return re.compile('[^A-Za-z0-9.]+').sub('_', name).lower() - - -def sensible_pname(egg_name): - """Guess Debian package name from Egg name.""" - egg_name = safe_name(egg_name).replace('_', '-') - if egg_name.startswith('python-'): - egg_name = egg_name[7:] - return "python3-%s" % egg_name.lower() - - -def ci_regexp(name): - """Return case insensitive dpkg -S regexp.""" - return ''.join("[%s%s]" % (i.upper(), i) if i.isalpha() else i for i in name.lower()) diff -Nru python3-defaults-3.2.3/debpython/tools.py python3-defaults-3.4.0/debpython/tools.py --- python3-defaults-3.2.3/debpython/tools.py 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/debpython/tools.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,244 +0,0 @@ -# -*- coding: UTF-8 -*- -# Copyright © 2010 Piotr Ożarowski -# -# 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 logging -import os -import re -from pickle import dumps -from os.path import exists, isdir, islink, join, split -from subprocess import PIPE, Popen -from debpython.version import SUPPORTED, getver, vrepr - -log = logging.getLogger(__name__) -EGGnPTH_RE = re.compile(r'(.*?)(-py\d\.\d(?:-[^.]*)?)?(\.egg-info|\.pth)$') -SHEBANG_RE = re.compile(r'^#!\s*/usr/bin/(?:env\s+)?(python(\d+(?:\.\d+)?)?(?:-dbg)?).*') - - -def sitedir(version, package=None, gdb=False): - """Return path to site-packages directory. - - Note that returned path is not the final location of .py files - - >>> sitedir((3, 1)) - '/usr/lib/python3/dist-packages/' - >>> sitedir((3, 1), 'python-foo', True) - 'debian/python-foo/usr/lib/debug/usr/lib/python3/dist-packages/' - >>> sitedir((3, 2)) - '/usr/lib/python3/dist-packages/' - """ - if isinstance(version, str): - version = tuple(int(i) for i in version.split('.')) - - path = '/usr/lib/python3/dist-packages/' - - if gdb: - path = "/usr/lib/debug%s" % path - if package: - path = "debian/%s%s" % (package, path) - - return path - - -def relpath(target, link): - """Return relative path. - - >>> relpath('/usr/share/python-foo/foo.py', '/usr/bin/foo', ) - '../share/python-foo/foo.py' - """ - t = target.split('/') - l = link.split('/') - while l[0] == t[0]: - del l[0], t[0] - return '/'.join(['..'] * (len(l) - 1) + t) - - -def relative_symlink(target, link): - """Create relative symlink.""" - return os.symlink(relpath(target, link), link) - - -def move_file(fpath, dstdir): - """Move file to dstdir. Works with symlinks (including relative ones).""" - if isdir(fpath): - dname = split(fpath)[-1] - for fn in os.listdir(fpath): - move_file(join(fpath, fn), join(dstdir, dname)) - - if islink(fpath): - dstpath = join(dstdir, split(fpath)[-1]) - relative_symlink(os.readlink(fpath), dstpath) - os.remove(fpath) - else: - os.rename(fpath, dstdir) - - -def shebang2pyver(fname): - """Check file's shebang. - - :rtype: tuple - :returns: pair of Python interpreter string and Python version - """ - try: - with open(fname, 'rb') as fp: - data = fp.read(32) - if b"\0" in data: - # binary file - return None - match = SHEBANG_RE.match(str(data, 'utf-8')) - if not match: - return None - res = match.groups() - if res != (None, None): - if res[1]: - if len(res[1]) == 1: # "python3" - res = (res[0], None) - else: - res = res[0], getver(res[1]) - return res - except IOError: - log.error('cannot open %s', fname) - - -def clean_egg_name(name): - """Remove Python version and platform name from Egg files/dirs. - - >>> clean_egg_name('python_pipeline-0.1.3_py3k-py3.1.egg-info') - 'python_pipeline-0.1.3_py3k.egg-info' - >>> clean_egg_name('Foo-1.2-py2.7-linux-x86_64.egg-info') - 'Foo-1.2.egg-info' - """ - match = EGGnPTH_RE.match(name) - if match and match.group(2) is not None: - return ''.join(match.group(1, 3)) - return name - - -class memoize: - def __init__(self, func): - self.func = func - self.cache = {} - - def __call__(self, *args, **kwargs): - key = dumps((args, kwargs)) - if key not in self.cache: - self.cache[key] = self.func(*args, **kwargs) - return self.cache[key] - - -@memoize -def get_magic_tags_map(versions=None): - """Return Python magic tags for installed Python versions. - - :param versions: list of versions to check - """ - - if not versions: - versions = set(SUPPORTED) - versions = set(versions) - {(3, 1)} - cmd = '' - for v in vrepr(versions): - if not exists("/usr/bin/python%s" % v): - log.debug("version %s not installed, skipping", v) - continue - - cmd += "/usr/bin/python%s -c 'import imp; print(\"%s_\"" % (v, v) + \ - "+imp.get_tag())' && " - - result = {(3, 1): None} - if not cmd: - return result - cmd = cmd[:-3] # cut last '&& ' - log.debug("invoking %s", cmd) - p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE) - if p.wait() != 0: - log.debug(p.stderr.read()) - raise Exception('cannot get magic tags') - else: - for line in p.stdout: - vers, magic_tag = str(line, 'utf-8').split('_', 2) - # Python 3.X returns bytes - magic_tag = magic_tag.strip().lstrip("b'").rstrip("'") - result[getver(vers)] = magic_tag - log.debug('magic tags map: %s', result) - return result - - -@memoize -def get_magic_numbers_map(versions=None): - """Return Python magic numbers for installed Python versions. - - :param versions: list of versions to check - """ - - if not versions: - versions = set(SUPPORTED) - versions = set(versions) - {(3, 1)} - cmd = '' - for v in vrepr(versions): - if not exists("/usr/bin/python%s" % v): - log.debug("version %s not installed, skipping", v) - continue - - cmd += "/usr/bin/python%s -c 'import imp; print(\"%s_%%s\"" % (v, v) + \ - "% imp.get_magic())' && " - - result = {(3, 1): None} - if not cmd: - return result - cmd = cmd[:-3] # cut last '&& ' - log.debug("invoking %s", cmd) - p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE) - if p.wait() != 0: - log.debug(p.stderr.read()) - raise Exception('cannot get magic numbers') - else: - for line in p.stdout: - vers, magic = str(line, 'utf-8').split('_', 2) - # Python 3.X returns bytes - result[getver(vers)] = eval(magic) - log.debug('magic numbers map: %s', result) - return result - - -def cache_from_source(fpath, version, debug_override=None): - """Emulate Python 3.2's imp.cache_from_source. - - :param fpath: path to file name - :param version: Python version - :type version: tuple - :param debug_override: if not ``None``, overrides ``__debug__`` - - >>> cache_from_source('foo.py', (3, 1)) - 'foo.pyc' - >>> cache_from_source('bar/foo.py', (3, 2), False) - 'bar/__pycache__/foo.cpython-32.pyo' - """ - if debug_override is None: - debug_override = __debug__ - - last_char = 'c' if debug_override else 'o' - if version == (3, 1): - return fpath + last_char - - tag_map = get_magic_tags_map() - fdir, fname = split(fpath) - return join(fdir, '__pycache__', "%s.%s.py%s" % \ - (fname[:-3], tag_map[version], last_char)) diff -Nru python3-defaults-3.2.3/debpython/version.py python3-defaults-3.4.0/debpython/version.py --- python3-defaults-3.2.3/debpython/version.py 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/debpython/version.py 2014-03-23 08:14:08.000000000 +0000 @@ -21,36 +21,213 @@ import logging import re -from os.path import exists, join, dirname +from os import environ +from os.path import exists from configparser import ConfigParser from types import GeneratorType # will be overriden via debian_defaults file few lines later -SUPPORTED = [(3, 2)] -DEFAULT = (3, 2) +SUPPORTED = [(3, 4),] +DEFAULT = (3, 4) RANGE_PATTERN = r'(-)?(\d\.\d+)(?:(-)(\d\.\d+)?)?' RANGE_RE = re.compile(RANGE_PATTERN) +VERSION_RE = re.compile(r''' + (?P\d+)\.? + (?P\d+)?\.? + (?P\d+)?[.\s]? + (?Palpha|beta|candidate|final)?[.\s]? + (?P\d+)?''', re.VERBOSE) log = logging.getLogger(__name__) # try to read debian_defaults and get a list of supported Python versions and # the default one from there -_config = ConfigParser() -_config.read(['/usr/share/python3/debian_defaults', - join(dirname(__file__), '..', 'debian', 'debian_defaults')]) +_supported = environ.get('DEBPYTHON3_SUPPORTED') +_default = environ.get('DEBPYTHON3_DEFAULT') +if not _supported or not _default: + _config = ConfigParser() + _config.read('/usr/share/python3/debian_defaults') + if not _default: + _default = _config.get('DEFAULT', 'default-version')[6:] + if not _supported: + _supported = _config.get('DEFAULT', 'supported-versions')\ + .replace('python', '') try: - DEFAULT = tuple(int(i) for i in _config.get('DEFAULT', - 'default-version')[6:].split('.')) -except: + DEFAULT = tuple(int(i) for i in _default.split('.')) +except Exception: log.exception('cannot read debian_defaults') try: - SUPPORTED = tuple(tuple(int(j) for j in i.strip()[6:].split('.'))\ - for i in _config.get('DEFAULT', - 'supported-versions').split(',')) -except: + SUPPORTED = tuple(tuple(int(j) for j in i.strip().split('.')) + for i in _supported.split(',')) +except Exception: log.exception('cannot read debian_defaults') +class Version: + def __init__(self, value=None, major=None, minor=None, micro=None, + releaselevel=None, serial=None): + if isinstance(value, (tuple, list)): + value = '.'.join(str(i) for i in value) + if isinstance(value, Version): + for name in ('major', 'minor', 'micro', 'releaselevel', 'serial'): + setattr(self, name, getattr(value, name)) + return + comp = locals() + del comp['self'] + del comp['value'] + if value: + match = VERSION_RE.match(value) + for name, value in match.groupdict().items() if match else []: + if value is not None and comp[name] is None: + comp[name] = value + for name, value in comp.items(): + if name != 'releaselevel' and value is not None: + value = int(value) + setattr(self, name, value) + if not self.major: + raise ValueError('major component is required') + + def __str__(self): + """Return major.minor or major string. + + >>> str(Version(major=3, minor=2, micro=1, releaselevel='final', serial=4)) + '3.2' + >>> str(Version(major=2)) + '2' + """ + result = str(self.major) + if self.minor is not None: + result += '.{}'.format(self.minor) + return result + + def __hash__(self): + return hash(repr(self)) + + def __repr__(self): + """Return full version string. + + >>> repr(Version(major=3, minor=2, micro=1, releaselevel='final', serial=4)) + "Version('3.2.1.final.4')" + >>> repr(Version(major=2)) + "Version('2')" + """ + result = "Version('{}".format(self) + for name in ('micro', 'releaselevel', 'serial'): + value = getattr(self, name) + if not value: + break + result += '.{}'.format(value) + return result + "')" + + def __add__(self, other): + """Return next version. + + >>> Version('3.1') + 1 + Version('3.2') + >>> Version('2') + '1' + Version('3') + """ + result = Version(self) + if self.minor is None: + result.major += int(other) + else: + result.minor += int(other) + return result + + def __sub__(self, other): + """Return previous version. + + >>> Version('3.1') - 1 + Version('3.0') + >>> Version('3') - '1' + Version('2') + """ + result = Version(self) + if self.minor is None: + result.major -= int(other) + new = result.major + else: + result.minor -= int(other) + new = result.minor + if new < 0: + raise ValueError('cannot decrease version further') + return result + + def __eq__(self, other): + return self.__cmp(other) == 0 + + def __lt__(self, other): + return self.__cmp(other) < 0 + + def __le__(self, other): + return self.__cmp(other) <= 0 + + def __gt__(self, other): + return self.__cmp(other) > 0 + + def __ge__(self, other): + return self.__cmp(other) >= 0 + + def __lshift__(self, other): + """Compare major.minor or major only (if minor is not set). + + >>> Version('2.6') << Version('2.7') + True + >>> Version('2.6') << Version('2.6.6') + False + >>> Version('3') << Version('2') + False + >>> Version('3.1') << Version('2') + False + >>> Version('2') << Version('3.2.1.alpha.3') + True + """ + if not isinstance(other, Version): + other = Version(other) + if self.minor is None or other.minor is None: + return self.__cmp(other, ignore='minor') < 0 + else: + return self.__cmp(other, ignore='micro') < 0 + + def __rshift__(self, other): + """Compare major.minor or major only (if minor is not set). + + >>> Version('2.6') >> Version('2.7') + False + >>> Version('2.6.7') >> Version('2.6.6') + False + >>> Version('3') >> Version('2') + True + >>> Version('3.1') >> Version('2') + True + >>> Version('2.1') >> Version('3.2.1.alpha.3') + False + """ + if not isinstance(other, Version): + other = Version(other) + if self.minor is None or other.minor is None: + return self.__cmp(other, ignore='minor') > 0 + else: + return self.__cmp(other, ignore='micro') > 0 + + def __cmp(self, other, ignore=None): + if not isinstance(other, Version): + other = Version(other) + for name in ('major', 'minor', 'micro', 'releaselevel', 'serial'): + if name == ignore: + break + value1 = getattr(self, name) or 0 + value2 = getattr(other, name) or 0 + if name == 'releaselevel': + rmap = {'alpha': -3, 'beta': -2, 'candidate': -1, 'final': 0} + value1 = rmap.get(value1, 0) + value2 = rmap.get(value2, 0) + if value1 == value2: + continue + return (value1 > value2) - (value1 < value2) + return 0 + + def get_requested_versions(vrange=None, available=None): """Return a set of requested and supported Python versions. @@ -60,7 +237,7 @@ :type available: bool >>> sorted(get_requested_versions([(3, 0), None])) - [(3, 2)] + [(3, 2), (3, 3)] >>> sorted(get_requested_versions('')) == sorted(SUPPORTED) True >>> sorted(get_requested_versions([None, None])) == sorted(SUPPORTED) @@ -82,10 +259,10 @@ versions = set(v for v in SUPPORTED if minv <= v < maxv) if available: - versions = set(v for v in versions \ + versions = set(v for v in versions if exists("/usr/bin/python%d.%d" % v)) elif available is False: - versions = set(v for v in versions \ + versions = set(v for v in versions if not exists("/usr/bin/python%d.%d" % v)) return versions @@ -136,7 +313,7 @@ def parse_pycentral_vrange(value): - """Parse XS-Python-Version. + """Parse X-Python3-Version. >>> parse_pycentral_vrange('>= 3.1') ((3, 1), None) @@ -147,7 +324,7 @@ >>> parse_pycentral_vrange('3.1, 3.2') ((3, 1), None) """ - get = lambda x: get_requested_versions(parse_vrange(x)) + #get = lambda x: get_requested_versions(parse_vrange(x)) minv = maxv = None hardcoded = set() @@ -175,8 +352,7 @@ # yeah, no maxv! minv = sorted(hardcoded)[0] - return getver(minv) if minv else None, \ - getver(maxv) if maxv else None + return getver(minv) if minv else None, getver(maxv) if maxv else None def vrange_str(vrange): @@ -221,8 +397,7 @@ """ if isinstance(value, str): return value - elif not isinstance(value, (GeneratorType, set))\ - and isinstance(value[0], int): + elif not isinstance(value, (GeneratorType, set)) and isinstance(value[0], int): return '.'.join(str(i) for i in value) result = [] @@ -241,11 +416,15 @@ (3, 2) >>> getver('3.1.4') (3, 1) + >>> getver((3, 3, 1)) + (3, 3) >>> getver(None) '' """ if not value: return '' + if isinstance(value, tuple): + return value[:2] return tuple(int(i) for i in value.split('.', 2))[:2] diff -Nru python3-defaults-3.2.3/dh_python3 python3-defaults-3.4.0/dh_python3 --- python3-defaults-3.2.3/dh_python3 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/dh_python3 1970-01-01 00:00:00.000000000 +0000 @@ -1,445 +0,0 @@ -#! /usr/bin/python3 -# vim: et ts=4 sw=4 - -# Copyright © 2010-2012 Piotr Ożarowski -# -# 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 logging -import os -import re -import sys -from filecmp import cmp as cmpfile -from optparse import OptionParser, SUPPRESS_HELP -from os.path import isdir, exists, join -from shutil import rmtree, copy as fcopy -from stat import ST_MODE, S_IXUSR, S_IXGRP, S_IXOTH -sys.path.insert(1, '/usr/share/python3/') -from debpython.debhelper import DebHelper -from debpython.depends import Dependencies -from debpython.version import SUPPORTED, DEFAULT, \ - getver, vrepr, parse_pycentral_vrange, \ - parse_vrange, vrange_str -from debpython.pydist import validate as validate_pydist, \ - PUBLIC_DIR_RE -from debpython.tools import sitedir, shebang2pyver, clean_egg_name -from debpython.option import Option - -# initialize script -logging.basicConfig(format='%(levelname).1s: %(module)s:%(lineno)d: ' - '%(message)s') -log = logging.getLogger(__name__) -os.umask(0o22) - -# tag that will be added to .so files without one -EXTENSION_TAG = 'cpython-%smu' -DBG_EXTENSION_TAG = 'cpython-%sdmu' -TAG_RE = re.compile(r'-([0-9]{2})[^-.]*\.so$') - -# naming conventions used in the file: -# * version - tuple of integers -# * ver - string representation of version -# * vrange - version range, pair of max and min versions -# * fn - file name (without path) -# * fpath - file path - - -### FILES ###################################################### -def fix_locations(package): - """Move files to the right location.""" - for version in SUPPORTED: - ver = vrepr(version) - to_check = [i % ver for i in (\ - 'usr/local/lib/python%s/site-packages', - 'usr/local/lib/python%s/dist-packages', - 'usr/lib/python%s/site-packages', - 'usr/lib/python%s/dist-packages', - 'var/lib/python-support/python%s', - 'usr/lib/pymodules/python%s')] - dstdir = sitedir(version, package) - - for location in to_check: - srcdir = "debian/%s/%s" % (package, location) - if isdir(srcdir): - log.warn('Python %s should install files in %s. ' - 'Did you forget "--install-layout=deb"?', - ver, sitedir(version)) - # TODO: what about relative symlinks? - log.debug('moving files from %s to %s', srcdir, dstdir) - share_files(srcdir, dstdir, package.endswith('-dbg')) - parent_dir = '/'.join(srcdir.split('/')[:-1]) - if exists(parent_dir) and not os.listdir(parent_dir): - os.rmdir(parent_dir) - - # do the same with debug locations - dbg_to_check = ['usr/lib/debug/%s' % i for i in to_check] - dbg_to_check.append("usr/lib/debug/usr/lib/pyshared/python%s" % ver) - dstdir = sitedir(version, package, gdb=True) - - for location in dbg_to_check: - srcdir = "debian/%s/%s" % (package, location) - if isdir(srcdir): - log.debug('moving files from %s to %s', srcdir, dstdir) - share_files(srcdir, dstdir, package.endswith('-dbg')) - parent_dir = '/'.join(srcdir.split('/')[:-1]) - if exists(parent_dir) and not os.listdir(parent_dir): - os.rmdir(parent_dir) - - -def share_files(srcdir, dstdir, dbg_package=False): - """Try to move as many files from srcdir to dstdir as possible.""" - for i in os.listdir(srcdir): - fpath1 = join(srcdir, i) - if i.rsplit('.', 1)[-1] == 'so' and 'cpython' not in i: - # try to rename extension here as well (in :meth:`scan` info about - # Python version is gone) - public_dir = PUBLIC_DIR_RE.match(srcdir) - fpath1_orig = fpath1 - i = tagged_extname(i, public_dir.groups()[0], dbg_package) - fpath1 = join(srcdir, i) - log.warn('renaming %s to %s', fpath1_orig, fpath1) - os.rename(fpath1_orig, fpath1) - fpath2 = join(dstdir, i) - if not exists(fpath2): - os.renames(fpath1, fpath2) - continue - if isdir(fpath1): - share_files(fpath1, fpath2, dbg_package) - elif cmpfile(fpath1, fpath2, shallow=False): - os.remove(fpath1) - # XXX: check symlinks - - if exists(srcdir) and not os.listdir(srcdir): - os.rmdir(srcdir) - - -### PACKAGE DETAILS ############################################ -def tagged_extname(fname, version, dbg_package=False): - """Return tagged extension name for given file & version.""" - vers = vrepr(version) # make sure it's a string - vers = vers.replace('.', '') - if vers == '3': - # assume .so files without tag in /usr/lib/python3/ are build for Python 3.2 - vers = '32' - if fname.endswith('_d.so'): - fname = "%s.%s.so" % (fname[:-5], DBG_EXTENSION_TAG % vers) - elif dbg_package: - fname = "%s.%s.so" % (fname[:-3], DBG_EXTENSION_TAG % vers) - else: - fname = "%s.%s.so" % (fname[:-3], EXTENSION_TAG % vers) - return fname - - -def scan(package, dname=None, clean_dbg_pkg=True): - """Gather statistics about Python files in given package.""" - r = {'requires.txt': set(), - 'shebangs': set(), - 'private_dirs': {}, - 'compile': False, - 'ext': set()} - - dbg_package = package.endswith('-dbg') - - if not dname: - proot = "debian/%s" % package - if dname is False: - private_to_check = [] - else: - private_to_check = [i % package for i in - ('usr/lib/%s', 'usr/lib/games/%s', - 'usr/share/%s', 'usr/share/games/%s')] - else: - proot = join('debian', package, dname.strip('/')) - private_to_check = [dname[1:]] - - for root, dirs, file_names in os.walk(proot): - # ignore Python 2.X locations - if '/usr/lib/python2' in root or\ - '/usr/local/lib/python2' in root or\ - '/usr/share/pyshared/' in root or\ - '/usr/lib/pyshared/' in root: - # warn only once - tmp = root.replace('/local', '').split('/') - if len(tmp) == 5: # debian/package/usr/foo/bar - log.warning('Python 2.x location detected, ' - 'please use dh_python2: %s', root) - continue - - bin_dir = private_dir = None - public_dir = PUBLIC_DIR_RE.match(root) - if not public_dir: - for i in private_to_check: - if root.startswith(join('debian', package, i)): - private_dir = '/' + i - break - else: # i.e. not public_dir and not private_dir - if len(root.split('/', 6)) < 6 and (\ - root.endswith('/sbin') or root.endswith('/bin') or\ - root.endswith('/usr/games')): - # /(s)bin or /usr/(s)bin or /usr/games - bin_dir = root - - for name in dirs: - if name == '__pycache__': - rmtree(join(root, name)) - dirs.pop(dirs.index(name)) - continue - # handle EGG related data (.egg-info dirs) - if name.endswith('.egg-info'): - if dbg_package and clean_dbg_pkg: - rmtree(join(root, name)) - dirs.pop(dirs.index(name)) - continue - clean_name = clean_egg_name(name) - if clean_name != name: - log.warn('renaming %s to %s', name, clean_name) - os.rename(join(root, name), join(root, clean_name)) - if root.endswith('.egg-info') and 'requires.txt' in file_names: - r['requires.txt'].add(join(root, 'requires.txt')) - continue - - # check files - for fn in file_names: - fext = fn.rsplit('.', 1)[-1] - if fext in ('pyc', 'pyo'): - os.remove(join(root, fn)) - continue - if public_dir: - if dbg_package and clean_dbg_pkg and fext not in ('so', 'h'): - os.remove(join(root, fn)) - continue - # assume all extensions were build using cPython - if fext == 'so' and 'cpython' not in fn: - old_fn = fn - fn = tagged_extname(fn, public_dir.groups()[0], dbg_package) - log.warn('renaming %s to %s', old_fn, fn) - os.rename(join(root, old_fn), join(root, fn)) - - elif private_dir: - if exists(join(root, fn)): - mode = os.stat(join(root, fn))[ST_MODE] - if mode & S_IXUSR or mode & S_IXGRP or mode & S_IXOTH: - res = shebang2pyver(join(root, fn)) - if res: - r['private_dirs'].setdefault(private_dir, {})\ - .setdefault('shebangs', set()).add(res) - - if public_dir or private_dir: - if fext == 'so': - tagver = TAG_RE.search(fn) - if tagver is None: - # yeah, python3.1 is not covered, but we don't want to - # mess with non-Python libraries, don't we? - continue - tagver = tagver.group(1) - tagver = getver("%s.%s" % (tagver[0], tagver[1])) - (r if public_dir else - r['private_dirs'].setdefault(private_dir, {}))\ - .setdefault('ext', set()).add(tagver) - continue - elif fext == 'py': - (r if public_dir else - r['private_dirs'].setdefault(private_dir, {}))\ - ['compile'] = True - continue - - # .egg-info files - if fn.endswith('.egg-info'): - clean_name = clean_egg_name(fn) - if clean_name != fn: - log.warn('renaming %s to %s', fn, clean_name) - os.rename(join(root, fn), join(root, clean_name)) - continue - # search for scripts in bin dirs - if bin_dir: - fpath = join(root, fn) - res = shebang2pyver(fpath) - if res: - r['shebangs'].add(res) - - if dbg_package and clean_dbg_pkg: - # remove empty directories in -dbg packages - proot = proot + '/usr/lib' - for root, dirs, file_names in os.walk(proot, topdown=False): - if '-packages/' in root and not file_names: - try: - os.rmdir(root) - except: - pass - - log.debug("package %s details = %s", package, r) - return r - - -################################################################ -def main(): - usage = '%prog -p PACKAGE [-V [X.Y][-][A.B]] DIR [-X REGEXPR]\n' - parser = OptionParser(usage, version='%prog 3.0~beta2', - option_class=Option) - parser.add_option('--no-guessing-deps', action='store_false', - dest='guess_deps', default=True, help='disable guessing dependencies') - parser.add_option('--skip-private', action='store_true', - dest='skip_private', default=False, - help='don\'t check private directories') - parser.add_option('-v', '--verbose', action='store_true', dest='verbose', - default=False, help='turn verbose mode on') - # arch=False->arch:all only, arch=True->arch:any only, None->all of them - parser.add_option('-i', '--indep', action='store_false', - dest='arch', default=None, - help='act on architecture independent packages') - parser.add_option('-a', '-s', '--arch', action='store_true', - dest='arch', help='act on architecture dependent packages') - parser.add_option('-q', '--quiet', action='store_false', dest='verbose', - help='be quiet') - parser.add_option('-p', '--package', action='append', dest='package', - help='act on the package named PACKAGE') - parser.add_option('-N', '--no-package', action='append', dest='no_package', - help='do not act on the specified package') - parser.add_option('-V', type='version_range', dest='vrange', - help='specify list of supported Python versions. ' +\ - 'See py3compile(1) for examples') - parser.add_option('-X', '--exclude', action='append', dest='regexpr', - help='exclude items that match given REGEXPR. You may use this option ' - 'multiple times to build up a list of things to exclude.') - parser.add_option('--depends', action='append', dest='depends', - help='translate given requirements into Debian dependencies ' - 'and add them to ${python:Depends}. ' - 'Use it for missing items in requires.txt.') - parser.add_option('--recommends', action='append', dest='recommends', - help='translate given requirements into Debian ' - 'dependencies and add them to ${python:Recommends}') - parser.add_option('--suggests', action='append', dest='suggests', - help='translate given requirements into Debian ' - 'dependencies and add them to ${python:Suggests}') - parser.add_option('--no-dbg-cleaning', action='store_false', - dest='clean_dbg_pkg', default=True, - help='do not remove files from debug packages') - # ignore some debhelper options: - parser.add_option('-O', help=SUPPRESS_HELP) - - (options, args) = parser.parse_args(sys.argv[1:] + \ - os.environ.get('DH_OPTIONS', '').split()) - # regexpr option type is not used so lets check patterns here - for pattern in options.regexpr or []: - # fail now rather than at runtime - try: - pattern = re.compile(pattern) - except: - log.error('regular expression is not valid: %s', pattern) - exit(1) - - if not options.vrange and exists('debian/pyversions'): - log.debug('parsing version range from debian/pyversions') - with open('debian/pyversions', 'r', encoding='utf-8') as fp: - for line in fp: - line = line.strip() - if line and not line.startswith('#'): - options.vrange = parse_vrange(line) - break - - private_dir = None if not args else args[0] - # TODO: support more than one private dir at the same time (see :meth:scan) - if options.skip_private: - private_dir = False - - if options.verbose or os.environ.get('DH_VERBOSE') == '1': - log.setLevel(logging.DEBUG) - log.debug('argv: %s', sys.argv) - log.debug('options: %s', options) - log.debug('args: %s', args) - - try: - dh = DebHelper(options.package, options.no_package) - except Exception as e: - log.error('cannot initialize DebHelper: %s', e) - exit(2) - if not options.vrange and dh.python_version: - options.vrange = parse_pycentral_vrange(dh.python_version) - - for package, pdetails in dh.packages.items(): - if options.arch is False and pdetails['arch'] != 'all' or \ - options.arch is True and pdetails['arch'] == 'all': - continue - log.debug('processing package %s...', package) - if not private_dir: - fix_locations(package) - stats = scan(package, private_dir, options.clean_dbg_pkg) - - dependencies = Dependencies(package) - dependencies.parse(stats, options) - dependencies.export_to(dh) - - if stats['ext']: - dh.addsubstvar(package, 'python3:Versions', \ - ', '.join(sorted(vrepr(stats['ext'])))) - ps = package.split('-', 1) - if len(ps) > 1 and ps[0] == 'python3': - dh.addsubstvar(package, 'python3:Provides', \ - ', '.join("python%s-%s" % (i, ps[1])\ - for i in sorted(vrepr(stats['ext'])))) - - pyclean_added = False # invoke pyclean only once in maintainer script - if stats['compile']: - dh.autoscript(package, 'postinst', 'postinst-py3compile', '') - dh.autoscript(package, 'prerm', 'prerm-py3clean', '') - pyclean_added = True - for pdir, details in stats['private_dirs'].items(): - if not details.get('compile'): - continue - if not pyclean_added: - dh.autoscript(package, 'prerm', 'prerm-py3clean', '') - pyclean_added = True - - args = pdir - - ext_for = details.get('ext') - if ext_for is None: # no extension - if options.vrange and options.vrange != (None, None): - args += " -V %s" % vrange_str(options.vrange) - elif False in ext_for: # extension's version not detected - if options.vrange and '-' not in vrange_str(options.vrange): - ver = vrange_str(options.vrange) - else: # try shebang or default Python version - ver = (list(v for i, v in details.get('shebangs', []) - if v) or [None])[0] or DEFAULT - args += " -V %s" % vrepr(ver) - else: - extensions = sorted(ext_for) - vr = (extensions[0], extensions[-1]) - args += " -V %s" % vrange_str(vr) - - for pattern in options.regexpr or []: - args += " -X '%s'" % pattern.replace("'", r"\'") - - dh.autoscript(package, 'postinst', 'postinst-py3compile', args) - - pydist_file = join('debian', "%s.pydist" % package) - if exists(pydist_file): - if not validate_pydist(pydist_file, True): - log.warning("%s.pydist file is invalid", package) - else: - dstdir = join('debian', package, 'usr/share/python3/dist/') - if not exists(dstdir): - os.makedirs(dstdir) - fcopy(pydist_file, join(dstdir, package)) - - dh.save() - -if __name__ == '__main__': - main() diff -Nru python3-defaults-3.2.3/dh_python3.1 python3-defaults-3.4.0/dh_python3.1 --- python3-defaults-3.2.3/dh_python3.1 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/dh_python3.1 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ -.TH DH_PYTHON3 "1" "September 2010" "dh_python3 3.0~beta2" "User Commands" -.SH NAME -dh_python3 \- calculates Python 3 dependencies, adds maintainer scripts to byte compile files, etc. -.SH SYNOPSIS -.B dh_python3 -\fI-p PACKAGE \fR[\fI-V \fR[\fIX.Y\fR][\fI-\fR][\fIA.B\fR]] \fIDIR_OR_FILE \fR[\fI-X REGEXPR\fR] -.SH OPTIONS -.TP -\fB\-\-version\fR -show program's version number and exit -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.TP -\fB\-\-no\-guessing\-deps\fR -disable guessing dependencies -.TP -\fB\-\-no\-dbg\-cleaning\fR -do not remove any files from debug packages -.TP -\fB\-\-skip\-private\fR -don't check private directories -.TP -\fB\-v\fR, \fB\-\-verbose\fR -turn verbose mode on -.TP -\fB\-i\fR, \fB\-\-indep\fR -act on architecture independent packages -.TP -\fB\-a\fR, \fB\-\-arch\fR -act on architecture dependent packages -.TP -\fB\-q\fR, \fB\-\-quiet\fR -be quiet -.TP -\fB\-p\fR PACKAGE, \fB\-\-package\fR=\fIPACKAGE\fR -act on the package named PACKAGE -.TP -\fB\-N\fR NO_PACKAGE, \fB\-\-no\-package\fR=\fINO_PACKAGE\fR -do not act on the specified package -.TP -\fB\-V\fR VRANGE -specify list of supported Python versions. See -py3compile(1) for examples -.TP -\fB\-X\fR REGEXPR, \fB\-\-exclude\fR=\fIREGEXPR\fR -exclude items that match given REGEXPR. You may use -this option multiple times to build up a list of -things to exclude. -.TP -\fB\-\-depends\fR=\fIDEPENDS\fR -translate given requirements into Debian dependencies -and add them to ${python:Depends}. Use it for missing -items in requires.txt. -.TP -\fB\-\-recommends\fR=\fIRECOMMENDS\fR -translate given requirements into Debian dependencies -and add them to ${python:Recommends} -.TP -\fB\-\-suggests\fR=\fISUGGESTS\fR -translate given requirements into Debian dependencies -and add them to ${python:Suggests} -.SH "SEE ALSO" -/usr/share/doc/python3-doc/README.PyDist (python3-doc package) diff -Nru python3-defaults-3.2.3/Makefile python3-defaults-3.4.0/Makefile --- python3-defaults-3.2.3/Makefile 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/Makefile 2013-08-03 07:34:39.000000000 +0000 @@ -1,46 +1,40 @@ #!/usr/bin/make -f INSTALL ?= install PREFIX ?= /usr/local +MANPAGES ?= py3compile.1 py3clean.1 +VERSION=$(shell dpkg-parsechangelog | sed -rne 's,^Version: (.+),\1,p') clean: - make -C tests clean - make -C pydist clean find . -name '*.py[co]' -delete - rm -f .coverage + find . -name __pycache__ -type d | xargs rm -rf + rm -f .coverage $(MANPAGES) install-dev: $(INSTALL) -m 755 -d $(DESTDIR)$(PREFIX)/bin \ - $(DESTDIR)$(PREFIX)/share/python3/runtime.d \ - $(DESTDIR)$(PREFIX)/share/debhelper/autoscripts/ \ - $(DESTDIR)$(PREFIX)/share/perl5/Debian/Debhelper/Sequence/ + $(DESTDIR)$(PREFIX)/share/python3/runtime.d $(INSTALL) -m 755 runtime.d/* $(DESTDIR)$(PREFIX)/share/python3/runtime.d/ - $(INSTALL) -m 644 autoscripts/* $(DESTDIR)$(PREFIX)/share/debhelper/autoscripts/ - $(INSTALL) -m 755 dh_python3 $(DESTDIR)$(PREFIX)/bin/ - $(INSTALL) -m 644 python3.pm $(DESTDIR)$(PREFIX)/share/perl5/Debian/Debhelper/Sequence/ install-runtime: $(INSTALL) -m 755 -d $(DESTDIR)$(PREFIX)/share/python3/debpython $(DESTDIR)$(PREFIX)/bin $(INSTALL) -m 644 debpython/*.py $(DESTDIR)$(PREFIX)/share/python3/debpython/ $(INSTALL) -m 755 py3compile $(DESTDIR)$(PREFIX)/bin/ + sed -i -e 's/DEVELV/$(VERSION)/' $(DESTDIR)$(PREFIX)/bin/py3compile $(INSTALL) -m 755 py3clean $(DESTDIR)$(PREFIX)/bin/ + sed -i -e 's/DEVELV/$(VERSION)/' $(DESTDIR)$(PREFIX)/bin/py3clean install: install-dev install-runtime -dist_fallback: - make -C pydist $@ +%.1: %.rst + rst2man $< > $@ + +manpages: $(MANPAGES) pdebuild: pdebuild --debbuildopts -I # TESTS -nose: - nosetests-3 --with-doctest --with-coverage - -tests: nose - make -C tests - -test%: - make -C tests $@ +tests: + nosetests3 --with-doctest --with-coverage check_versions: @PYTHONPATH=. set -e; \ diff -Nru python3-defaults-3.2.3/py3clean python3-defaults-3.4.0/py3clean --- python3-defaults-3.2.3/py3clean 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/py3clean 2012-12-11 23:33:09.000000000 +0000 @@ -1,7 +1,7 @@ #! /usr/bin/python3 # vim: et ts=4 sw=4 -# Copyright © 2010 Piotr Ożarowski +# Copyright © 2010-2012 Piotr Ożarowski # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -24,13 +24,14 @@ import logging import optparse import sys +# glob1() is not in the public documentation, UTSL. from glob import glob1 -from os import environ, remove, rmdir, walk -from os.path import dirname, exists, isdir, isfile, join -from subprocess import Popen, PIPE +from os import environ, remove, rmdir +from os.path import dirname, basename, exists, join, splitext sys.path.insert(1, '/usr/share/python3/') +from debpython import files as dpf +from debpython.interpreter import Interpreter from debpython.version import SUPPORTED, getver, vrepr -from debpython.tools import get_magic_tags_map # initialize script @@ -50,10 +51,19 @@ def get_magic_tag_to_remove(version): """Returns magic tag or True if all of them should be removed.""" - map_ = get_magic_tags_map(set(SUPPORTED).union(set([version]))) - if version != (3, 1) and version not in map_: - log.error('magic tag for %s not recognized', vrepr(version)) - exit(4) + i = Interpreter('python') + map_ = {} + for v in SUPPORTED: + try: + map_[v] = i.magic_tag(v) + except Exception: + log.debug('magic tag for %s not recognized', vrepr(v), exc_info=True) + if version not in map_: + try: + map_[version] = i.magic_tag(version) + except Exception as e: + log.error('cannot find magic tag for Python %s: %s', vrepr(version), e) + exit(4) tag = map_[version] # skip shared tags @@ -62,7 +72,7 @@ continue if t == tag: log.info('magic tag(s) used by python%s. Nothing to remove.', - vrepr(v)) + vrepr(v)) exit(0) log.debug('magic tags to remove: %s', tag) @@ -72,16 +82,23 @@ def destroyer(magic_tag=None): # ;-) """Remove every .py[co] file associated to received .py file. - :param magic_tag: if None, removes __pycache__ directories, - if False, removes python3.1's .pyc files only, - otherwise removes given magic tag from __pycache__ directory - :type magic_tag: None or False or str""" + :param magic_tag: + * If None, removes all associated .py[co] files from __pycache__ + directory. If the resulting directory is empty, and is not a system + site package, then the directory is also removed. + * If False, removes python3.1's .pyc files only + * Otherwise removes given magic tag from __pycache__ directory. If + the resulting directory is empty, and is not a system site package, + then the directory is also removed. + :type magic_tag: None or False or str + """ if magic_tag is None: - # remove all files in __pycache__ directory + # remove compiled files in __pycache__ directory def find_files_to_remove(pyfile): - directory = "%s/__pycache__/" % dirname(pyfile) - for fn in glob1(directory, '*'): + directory = join(dirname(pyfile), '__pycache__') + fnames = "%s.*" % splitext(basename(pyfile))[0] + for fn in glob1(directory, fnames): yield join(directory, fn) # remove "classic" .pyc files as well for filename in ("%sc" % pyfile, "%so" % pyfile): @@ -90,16 +107,17 @@ elif magic_tag is False: # remove 3.1's .pyc files only - def find_files_to_remove(pyfile): + def find_files_to_remove(pyfile): # NOQA for filename in ("%sc" % pyfile, "%so" % pyfile): if exists(filename): yield filename else: # remove .pyc files for no longer needed magic tags - def find_files_to_remove(pyfile): - directory = "%s/__pycache__/" % dirname(pyfile) - for fn in glob1(directory, "*.%s.py[co]" % magic_tag): + def find_files_to_remove(pyfile): # NOQA + directory = join(dirname(pyfile), '__pycache__') + fname = splitext(basename(pyfile))[0] + for fn in glob1(directory, "%s.%s.py[co]" % (fname, magic_tag)): yield join(directory, fn) def myremove(fname): @@ -109,7 +127,7 @@ if directory.endswith('__pycache__'): try: rmdir(directory) - except: + except Exception: pass counter = 0 @@ -127,43 +145,17 @@ log.info("removed files: %s", counter) -def get_files(items): - for item in items: - if isfile(item) and item.endswith('.py'): - yield item - elif isdir(item): - for root, dirs, files in walk(item): - #for fn in glob1(root, '*.py'): - # yield join(root, fn) - for fn in files: - if fn.endswith('.py'): - yield join(root, fn) - - -def get_package_files(package_name): - process = Popen("/usr/bin/dpkg -L %s" % package_name,\ - shell=True, stdout=PIPE) - stdout, stderr = process.communicate() - if process.returncode != 0: - log.error('cannot get content of %s', package_name) - exit(2) - stdout = str(stdout, 'utf-8') - for line in stdout.split('\n'): - if line.endswith('.py'): - yield line - - def main(): - usage = '%prog [-V VERSION] [-p PACKAGE | DIR_OR_FILE]' - parser = optparse.OptionParser(usage, version='%prog 0.3') + usage = '%prog [-V VERSION] [-p PACKAGE] [DIR_OR_FILE]' + parser = optparse.OptionParser(usage, version='%prog DEVELV') parser.add_option('-v', '--verbose', action='store_true', dest='verbose', - help='turn verbose more one') + help='turn verbose mode on') parser.add_option('-q', '--quiet', action='store_false', dest='verbose', - default=False, help='be quiet') + default=False, help='be quiet') parser.add_option('-p', '--package', - help='specify Debian package name to clean') + help='specify Debian package name to clean') parser.add_option('-V', dest='version', - help='specify Python version to clean') + help='specify Python version to clean') (options, args) = parser.parse_args() @@ -185,21 +177,24 @@ d = destroyer() # remove everything next(d) # initialize coroutine - if options.package and args: - parser.error('only one action is allowed at the same time (' - 'cleaning directory or a package)') + if not options.package and not args: + parser.print_usage() + exit(1) if options.package: log.info('cleaning package %s', options.package) - for filename in get_package_files(options.package): - d.send(filename) - elif args: + pfiles = set(dpf.from_package(options.package)) + + if args: log.info('cleaning directories: %s', args) - for filename in get_files(args): - d.send(filename) + files = set(dpf.from_directory(args)) + if options.package: + files = files & pfiles else: - parser.print_usage() - exit(1) + files = pfiles + + for filename in files: + d.send(filename) if __name__ == '__main__': main() diff -Nru python3-defaults-3.2.3/py3clean.1 python3-defaults-3.4.0/py3clean.1 --- python3-defaults-3.2.3/py3clean.1 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/py3clean.1 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -.TH PY3CLEAN "1" "September 2010" "py3clean 0.3" "User Commands" -.SH NAME -py3clean \- removes .pyc, .pyo files and __pycache__ directories -.SH SYNOPSIS -.B py3clean -[\fI-V VERSION\fR] [\fI-p PACKAGE | DIR_OR_FILE\fR] -.SH OPTIONS -.TP -\fB\-\-version\fR -show program's version number and exit -.TP -\fB\-h\fR, \fB\-\-help\fR -show this help message and exit -.TP -\fB\-v\fR, \fB\-\-verbose\fR -turn verbose more one -.TP -\fB\-q\fR, \fB\-\-quiet\fR -be quiet -.TP -\fB\-p\fR PACKAGE, \fB\-\-package\fR=\fIPACKAGE\fR -specify Debian package name to clean -.TP -\fB\-V\fR VERSION -specify Python version to clean \ No newline at end of file diff -Nru python3-defaults-3.2.3/py3clean.rst python3-defaults-3.4.0/py3clean.rst --- python3-defaults-3.2.3/py3clean.rst 1970-01-01 00:00:00.000000000 +0000 +++ python3-defaults-3.4.0/py3clean.rst 2013-04-10 12:46:12.000000000 +0000 @@ -0,0 +1,28 @@ +========== + py3clean +========== + +--------------------------- +removes .pyc and .pyo files +--------------------------- + +:Manual section: 1 +:Author: Piotr Ożarowski, 2012-2013 + +SYNOPSIS +======== + py3clean [-V VERSION] [-p PACKAGE] [DIR_OR_FILE] + +OPTIONS +======= +--version show program's version number and exit + +-h, --help show this help message and exit + +-v, --verbose turn verbose more one + +-q, --quiet be quiet + +-p PACKAGE, --package=PACKAGE specify Debian package name to clean + +-V VERSION specify Python 3 version to clean diff -Nru python3-defaults-3.2.3/py3compile python3-defaults-3.4.0/py3compile --- python3-defaults-3.2.3/py3compile 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/py3compile 2013-08-03 07:34:39.000000000 +0000 @@ -27,15 +27,15 @@ import os import struct import sys -from os import environ, listdir, mkdir, walk -from os.path import abspath, dirname, exists, isdir, isfile, join +from os import environ, listdir, mkdir +from os.path import dirname, exists, isdir, join from subprocess import PIPE, Popen sys.path.insert(1, '/usr/share/python3/') from debpython.version import SUPPORTED, debsorted, vrepr, \ - get_requested_versions, parse_vrange, getver + get_requested_versions, parse_vrange, getver +from debpython import files as dpf, PUBLIC_DIR_RE, memoize +from debpython.interpreter import Interpreter from debpython.option import Option, compile_regexpr -from debpython.pydist import PUBLIC_DIR_RE -from debpython.tools import cache_from_source, get_magic_numbers_map, memoize # initialize script logging.basicConfig(format='%(levelname).1s: %(module)s:%(lineno)d: ' @@ -54,54 +54,6 @@ """ -### FILES ###################################################### -def get_directory_files(dname): - """Generate *.py file names available in given directory.""" - if isfile(dname) and dname.endswith('.py'): - yield dname - else: - for root, dirs, file_names in walk(abspath(dname)): - #if root != dname and not exists(join(root, '__init__.py')): - # del dirs[:] - # continue - for fn in file_names: - if fn.endswith('.py'): - yield join(root, fn) - - -def get_package_files(package_name): - """Generate *.py file names available in given package.""" - process = Popen("/usr/bin/dpkg -L %s" % package_name,\ - shell=True, stdout=PIPE) - stdout, stderr = process.communicate() - if process.returncode != 0: - log.error('cannot get content of %s', package_name) - exit(2) - stdout = str(stdout, 'utf-8') - for line in stdout.split('\n'): - if line.endswith('.py'): - yield line - - -def get_private_files(files, dname): - """Generate *.py file names that match given directory.""" - for fn in files: - if fn.startswith(dname): - yield fn - - -def get_public_files(files, versions): - """Generate *.py file names that match given versions.""" - vstr = set("%d.%d" % i for i in versions) - shared_vstr = set(str(i[0]) for i in versions) - for fn in files: - public_dir = PUBLIC_DIR_RE.match(fn) - if public_dir: - vers = public_dir.group(1) - if vers in shared_vstr or vers in vstr: - yield fn - - ### EXCLUDES ################################################### @memoize def get_exclude_patterns_from_dir(name='/usr/share/python3/bcep/'): @@ -195,12 +147,13 @@ next(coroutine) STDINS[version] = coroutine + interpreter = Interpreter('python' if not optimize else 'python -O') + # byte compile files skip_dirs = set() - magic_numbers = get_magic_numbers_map(versions) for fn, versions_to_compile in filter_files(files, e_patterns, versions): for version in versions_to_compile: - cfn = cache_from_source(fn, version, not optimize) + cfn = interpreter.cache_file(fn, version) if version == (3, 1): if exists(cfn) and not force: ftime = os.stat(fn).st_mtime @@ -216,7 +169,7 @@ try: mtime = int(os.stat(fn).st_mtime) expect = struct.pack('<4sl', - magic_numbers[version], mtime) + interpreter.magic_number(version), mtime) with open(cfn, 'rb') as chandle: actual = chandle.read(8) if expect == actual: @@ -236,32 +189,33 @@ ################################################################ def main(): - usage = '%prog [-V [X.Y][-][A.B]] DIR_OR_FILE [-X REGEXPR]\n' + \ - ' %prog -p PACKAGE' - parser = optparse.OptionParser(usage, version='%prog 0.9', + usage = '%prog [-V [X.Y][-][A.B]] DIR_OR_FILE [-X REGEXPR]\n' +\ + ' %prog -p PACKAGE' + parser = optparse.OptionParser(usage, version='%prog DEVELV', option_class=Option) parser.add_option('-v', '--verbose', action='store_true', dest='verbose', - help='turn verbose mode on') + help='turn verbose mode on') parser.add_option('-q', '--quiet', action='store_false', dest='verbose', - default=False, help='be quiet') + default=False, help='be quiet') parser.add_option('-f', '--force', action='store_true', dest='force', - default=False, help='force rebuild even if timestamps are up-to-date') + default=False, + help='force rebuild even if timestamps are up-to-date') parser.add_option('-O', action='store_true', dest='optimize', - default=False, help="byte-compile to .pyo files") + default=False, help="byte-compile to .pyo files") parser.add_option('-p', '--package', - help='specify Debian package name whose files should be bytecompiled') + help='specify Debian package name whose files should be bytecompiled') parser.add_option('-V', type='version_range', dest='vrange', - help="""force private modules to be bytecompiled with Python version -from given range, regardless of the default Python version in the system. -If there are no other options, bytecompile all public modules for installed -Python versions that match given range. + help="""force private modules to be bytecompiled +with Python version from given range, regardless of the default Python version +in the system. If there are no other options, bytecompile all public modules +for installed Python versions that match given range. VERSION_RANGE examples: '3.1' (version 3.1 only), '3.1-' (version 3.1 or newer), '3.1-3.3' (version 3.1 or 3.2), '-4.0' (all supported 3.X versions)""") parser.add_option('-X', '--exclude', action='append', - dest='regexpr', type='regexpr', - help='exclude items that match given REGEXPR. You may use this option \ -multiple times to build up a list of things to exclude.') + dest='regexpr', type='regexpr', + help='exclude items that match given REGEXPR. \ +You may use this option multiple times to build up a list of things to exclude.') (options, args) = parser.parse_args() @@ -275,12 +229,12 @@ if options.regexpr and not args: parser.error('--exclude option works with private directories ' - 'only, please use /usr/share/python3/bcep to specify ' - 'public modules to skip') + 'only, please use /usr/share/python3/bcep to specify ' + 'public modules to skip') if options.vrange and options.vrange[0] == options.vrange[1] and\ - options.vrange != (None, None) and\ - exists("/usr/bin/python%d.%d" % options.vrange[0]): + options.vrange != (None, None) and\ + exists("/usr/bin/python%d.%d" % options.vrange[0]): # specific version requested, use it even if it's not in SUPPORTED versions = {options.vrange[0]} else: @@ -294,30 +248,30 @@ compile_versions = debsorted(versions)[:1] log.debug('compile versions: %s', versions) - pkg_files = tuple(get_package_files(options.package)) + pkg_files = tuple(dpf.from_package(options.package)) for item in args: - e_patterns = get_exclude_patterns(item, options.regexpr, \ + e_patterns = get_exclude_patterns(item, options.regexpr, compile_versions) if not exists(item): log.warn('No such file or directory: %s', item) else: log.debug('byte compiling %s using Python %s', item, compile_versions) - files = get_private_files(pkg_files, item) + files = dpf.filter_directory(pkg_files, item) compile(files, compile_versions, options.force, options.optimize, e_patterns) elif options.package: # package's public modules # no need to limit versions here, it's either pyr mode or version is # hardcoded in path / via -V option e_patterns = get_exclude_patterns() - files = get_package_files(options.package) - files = get_public_files(files, versions) + files = dpf.from_package(options.package) + files = dpf.filter_public(files, versions) compile(files, versions, options.force, options.optimize, e_patterns) - elif args: # other directories/files (private ones mostly) + elif args: # other directories/files for item in args: e_patterns = get_exclude_patterns(item, options.regexpr, versions) - files = get_directory_files(item) + files = dpf.from_directory(item) compile(files, versions, options.force, options.optimize, e_patterns) else: @@ -330,7 +284,7 @@ process.communicate() if process.returncode not in (None, 0): rv = process.returncode - sys.exit(rv) + exit(rv) if __name__ == '__main__': main() diff -Nru python3-defaults-3.2.3/py3compile.1 python3-defaults-3.4.0/py3compile.1 --- python3-defaults-3.2.3/py3compile.1 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/py3compile.1 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -.TH PY3COMPILE "1" "September 2010" "py3compile 0.9" "User Commands" -.SH NAME -py3compile \- byte compile Python 3 source files -.SH SYNOPSIS -.B py3compile -[\fI-V \fR[\fIX.Y\fR][\fI-\fR][\fIA.B\fR]] \fIDIR_OR_FILE \fR[\fI-X REGEXPR\fR] -.P -.B pycompile -\fB\-p\fR PACKAGE -.SH DESCRIPTION -Wrapper around -.B py_compile -to byte-compile python files. -.SH OPTIONS -.TP -\fB\-\-version\fR -Show program's version number and exit. -.TP -\fB\-h\fR, \fB\-\-help\fR -Show this help message and exit. -.TP -\fB\-f\fR, \fB\-\-force\fR -Force rebuild of byte-code files even if timestamps are up-to-date. -.TP -\fB\-O\fR -Byte-compile to .pyo files. -.TP -\fB\-q\fR, \fB\-\-quiet\fR -Be quiet. -.TP -\fB\-v\fR, \fB\-\-verbose\fR -Turn verbose mode on -.TP -\fB\-p\fR PACKAGE, \fB\-\-package\fR=\fIPACKAGE\fR -Specify Debian package name whose files should be -bytecompiled. -.TP -\fB\-V\fR VRANGE -Force private modules to be bytecompiled with Python -version from given range, regardless of the default -Python version in the system. If there are no other -options, bytecompile all public modules for installed -Python versions that match given range. VERSION_RANGE -examples: '3.1' (version 3.1 only), '3.1\-' (version -3.1 or newer), '3.1\-3.3' (version 3.1 or 3.2), '\-4.0' -(all supported 3.X versions). -.TP -\fB\-X\fR REGEXPR, \fB\-\-exclude\fR=\fIREGEXPR\fR -exclude items that match given REGEXPR. You may use -this option multiple times to build up a list of -things to exclude. diff -Nru python3-defaults-3.2.3/py3compile.rst python3-defaults-3.4.0/py3compile.rst --- python3-defaults-3.2.3/py3compile.rst 1970-01-01 00:00:00.000000000 +0000 +++ python3-defaults-3.4.0/py3compile.rst 2013-04-10 12:46:12.000000000 +0000 @@ -0,0 +1,52 @@ +============ + py3compile +============ + +---------------------------------- +byte compile Python 3 source files +---------------------------------- + +:Manual section: 1 +:Author: Piotr Ożarowski, 2012-2013 + +SYNOPSIS +======== + py3compile [-V [X.Y][-][A.B]] DIR_OR_FILE [-X REGEXPR] + + pycompile -p PACKAGE + +DESCRIPTION +=========== +Wrapper around Python standard library's py_compile module to byte-compile +Python 3 files. + +OPTIONS +======= +--version show program's version number and exit + +-h, --help show this help message and exit + +-f, --force force rebuild of byte-code files even if timestamps are up-to-date + +-O byte-compile to .pyo files + +-q, --quiet be quiet + +-v, --verbose turn verbose mode on + +-p PACKAGE, --package=PACKAGE specify Debian package name whose files should + be bytecompiled + +-V VRANGE force private modules to be bytecompiled with Python 3 + version from given range, regardless of the default Python 3 version in the + system. If there are no other options, bytecompile all public modules for + installed Python 3 versions that match given range. + VERSION_RANGE examples: + + * ``3.1`` version 3.1 only, + * ``3.1-`` version 3.1 or newer, + * ``3.1-3.3`` version 3.1 or 3.2, + * ``-4.0`` all supported 3.X versions + +-X REGEXPR, --exclude=REGEXPR exclude items that match given REGEXPR. You may + use this option multiple times to build up a list of things to exclude diff -Nru python3-defaults-3.2.3/pydist/dist_fallback python3-defaults-3.4.0/pydist/dist_fallback --- python3-defaults-3.2.3/pydist/dist_fallback 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/pydist/dist_fallback 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -setuptools python3-pkg-resources -PyYAML python3-yaml -py_postgresql python3-postgresql -pydns python3-dns -python3_libgearman python3-gearman.libgearman diff -Nru python3-defaults-3.2.3/pydist/generate_fallback_list.py python3-defaults-3.4.0/pydist/generate_fallback_list.py --- python3-defaults-3.2.3/pydist/generate_fallback_list.py 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/pydist/generate_fallback_list.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,76 +0,0 @@ -#! /usr/bin/python3 -# -*- coding: UTF-8 -*- -# Copyright © 2010 Piotr Ożarowski -# -# 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 - -skip_sensible_names = True if '--skip-sensible-names' in sys.argv else False -os.chdir(os.path.dirname(__file__)) -if os.path.isdir('../debpython'): - sys.path.append('..') -else: - sys.path.append('/usr/share/python3/debpython/') -from debpython.pydist import sensible_pname - - -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/lib/python3(\.[0-9])?/dist-packages/[^/]*\.egg-info"', - shell=True, stdout=PIPE) -stdout, stderr = process.communicate() -stdout = str(stdout, 'utf-8') -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 == 'python3-setuptools': - continue - if pname.startswith('python-'): - sys.stderr.write("W: Python 3 files in %s package!\n" % pname) - 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 skip_sensible_names and sensible_pname(egg_name) == pname: - continue - 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', encoding='utf-8') -fp.write('setuptools python3-pkg-resources\n') -fp.writelines(result) diff -Nru python3-defaults-3.2.3/pydist/Makefile python3-defaults-3.4.0/pydist/Makefile --- python3-defaults-3.2.3/pydist/Makefile 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/pydist/Makefile 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -#!/usr/bin/make -f - -clean: - rm -rf cache - #rm -f dist_fallback - rm -f README.PyDist.html - -dist_fallback: sources.list - python3 ./generate_fallback_list.py --skip-sensible-names - -README.PyDist.html: README.PyDist - rst2html $< $@ - -.PHONY: clean diff -Nru python3-defaults-3.2.3/pydist/README.PyDist python3-defaults-3.4.0/pydist/README.PyDist --- python3-defaults-3.2.3/pydist/README.PyDist 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/pydist/README.PyDist 1970-01-01 00:00:00.000000000 +0000 @@ -1,83 +0,0 @@ -============ -PyDist files -============ - -DISTNAME [VRANGE] [DEPENDENCY][; [PEP386] [RULES]] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -PyDist files help tools like dh_python3 to translate Python dependencies (from -setup.py's install_requires or egg's requires.txt file) to Debian dependencies. - - -Required fields: -~~~~~~~~~~~~~~~~ - -DISTNAME -```````` -Python distribution name (you can find it at the beginning of .egg-info -file/directory name that your package provides). - -Examples: - * SQLAlchemy - * Jinja2 - * numpy - - -Optional fields: -~~~~~~~~~~~~~~~~ - -VRANGE -`````` -Python version or version range the line applies to. - -Examples: - * 3.1 (Python 3.1 only) - * 3.1- (Python 3.1 and newer) - * 3.1-3.3 (Python 3.1 or 3.2) - * -3.4 (Python 3.3 or older) - -DEPENDENCY -`````````` -Debian dependency, multiple packages or versions are allowed. -If not set, given Python distribution name will be ignored. - -Examples: - * python3-mako - * python3-jinja2 | python3 (>= 3.0) - * python3-sqlalchemy (>= 0.5), python3-sqlalchemy (<< 0.6) - -PEP386 -`````` -Standards flag: upstream uses versioning schema described in PEP 386. - -RULES -````` -Rules needed to translate upstream version to Debian one. If PEP386 is -set, its rules will be applied later. Multiple rules are allowed, separate them -with a space. - -Examples: - * s/^/2:/ - * s/alpha/~alpha/ s/^/1:/ - - -Notes: -~~~~~~ - -You can use multiple lines if binary package provides more than one Python -distribution or if you want to specify different dependencies for each Python -version or version range. - -If you use dh_python3, it will install debian/binary_package_name.pydist file -to /usr/share/python3/dist/binary_package_name automatically. - - -Complete examples: -~~~~~~~~~~~~~~~~~~ - * SQLAlchemy python3-sqlalchemy (>= 0.5), python3-sqlalchemy (<< 0.6) - * Mako python3-mako; PEP386 - * foo -3.2 python3-oldfoo; s/^/3:/ - * foo 3.2- python3-foo; PEP386 - * Bar 2.6- - -.. vim: ft=rst diff -Nru python3-defaults-3.2.3/pydist/sources.list python3-defaults-3.4.0/pydist/sources.list --- python3-defaults-3.2.3/pydist/sources.list 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/pydist/sources.list 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -deb http://ftp.debian.org/debian/ unstable main -deb-src http://ftp.debian.org/debian/ unstable main diff -Nru python3-defaults-3.2.3/python3.pm python3-defaults-3.4.0/python3.pm --- python3-defaults-3.2.3/python3.pm 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/python3.pm 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -#! /usr/bin/perl -# debhelper sequence file for dh_python3 - -use warnings; -use strict; -use Debian::Debhelper::Dh_Lib; - -insert_after("dh_perl", "dh_python3"); - -1 diff -Nru python3-defaults-3.2.3/README.derivatives python3-defaults-3.4.0/README.derivatives --- python3-defaults-3.2.3/README.derivatives 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/README.derivatives 2013-08-03 07:34:39.000000000 +0000 @@ -1,35 +1,13 @@ How to change a list of supported Python versions? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -* Open debian/debian_defaults file and change `supported-versions` variable +* Open debian/debian_defaults file and change `supported-versions` variable, + separating multiple values by comma * Open debian/control.in file and edit python3-all, python3-all-dev and python3-all-dbg's Depends line (add or remove pythonX.Y packages) -* Open debpython/versions.py file and edit `SUPPORTED` list around - line 26 How to change default Python version? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Open debian/debian_defaults file and change `default-version` variable -* Open debian/rules file and edit `VER` variable (default version), `NVER` - (default + 1 version) and `PVER` (default version with "python" prefix) -* Open debian/py3versions.py file and edit `debian_default` variable around - line 171 -* Open debpython/versions.py file and edit `DEFAULT` variable around line 27 - - -How to bump minimum required Python version by dh_python2? -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -* Open debpython/depends.py file and edit `MINPYCDEP` variable around line 26 - - -How to regenerate dist_fallback file for dh_python3? -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Please note that we recommend to extend this file instead -(i.e. removing items from it can break other packages' dependencies) - -* Update pydist/sources.list file to point to your distro/suit -* Remove pydist/dist_fallback file -* Run `make dist_fallback` diff -Nru python3-defaults-3.2.3/tests/Makefile python3-defaults-3.4.0/tests/Makefile --- python3-defaults-3.2.3/tests/Makefile 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/tests/Makefile 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -#!/usr/bin/make -f - -# enable or disable tests here: -TESTS := test1 test2 test3 - -all: scripts $(TESTS) - -test%: - make -C t$* run - make -C t$* check - -clean-test%: - make -C t$* clean - -scripts: - sh ./test_scripts.sh - -clean: $(TESTS:%=clean-%) - rm -f *\.dsc *\.tar\.gz *\.build *\.changes *\.deb - @find . -prune -name '*.egg-info' -exec rm -rf '{}' ';' || true - -.PHONY: clean diff -Nru python3-defaults-3.2.3/tests/t1/debian/changelog python3-defaults-3.4.0/tests/t1/debian/changelog --- python3-defaults-3.2.3/tests/t1/debian/changelog 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/tests/t1/debian/changelog 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -foo (0.1.1) unstable; urgency=low - - * Initial release - - -- Piotr Ożarowski Sat, 27 Feb 2010 20:42:17 +0100 diff -Nru python3-defaults-3.2.3/tests/t1/debian/compat python3-defaults-3.4.0/tests/t1/debian/compat --- python3-defaults-3.2.3/tests/t1/debian/compat 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/tests/t1/debian/compat 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -7 diff -Nru python3-defaults-3.2.3/tests/t1/debian/control python3-defaults-3.4.0/tests/t1/debian/control --- python3-defaults-3.2.3/tests/t1/debian/control 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/tests/t1/debian/control 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -Source: foo -Section: python -Priority: optional -Maintainer: Piotr Ożarowski -Build-Depends: debhelper (>= 7.0.50~) -Build-Depends-Indep: python-all -Standards-Version: 3.9.0 -X-Python3-Version: >= 3.1 - -Package: python3-foo -Architecture: all -Depends: ${python3:Depends}, ${misc:Depends} -Recommends: ${python3:Recommends} -Suggests: ${python3:Suggests} -Enhances: ${python3:Enhances} -Breaks: ${python3:Breaks} -Provides: ${python3:Provides} -Description: foo to rule them all - exemple package #1 diff -Nru python3-defaults-3.2.3/tests/t1/debian/copyright python3-defaults-3.4.0/tests/t1/debian/copyright --- python3-defaults-3.2.3/tests/t1/debian/copyright 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/tests/t1/debian/copyright 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -The Debian packaging is © 2010, Piotr Ożarowski and -is licensed under the MIT License. diff -Nru python3-defaults-3.2.3/tests/t1/debian/py3dist-overrides python3-defaults-3.4.0/tests/t1/debian/py3dist-overrides --- python3-defaults-3.2.3/tests/t1/debian/py3dist-overrides 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/tests/t1/debian/py3dist-overrides 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -Mako python3-mako (>= 0.2) -SQLAlchemy python3-sqlalchemy (>= 0.6) -Foo python3-foo -Bar python3-bar -Baz \ No newline at end of file diff -Nru python3-defaults-3.2.3/tests/t1/debian/python3-foo.pydist python3-defaults-3.4.0/tests/t1/debian/python3-foo.pydist --- python3-defaults-3.2.3/tests/t1/debian/python3-foo.pydist 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/tests/t1/debian/python3-foo.pydist 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -SQLAlchemy 3.2- python3-sqlalchemy; PEP386 s/^/1:/ diff -Nru python3-defaults-3.2.3/tests/t1/debian/rules python3-defaults-3.4.0/tests/t1/debian/rules --- python3-defaults-3.2.3/tests/t1/debian/rules 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/tests/t1/debian/rules 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -#!/usr/bin/make -f -%: - dh $@ --buildsystem=python_distutils - -override_dh_auto_install: - python3 setup.py install --root=debian/python3-foo/ - -override_dh_pysupport: - find debian/ -name jquery.js -exec \ - ln -fs /usr/share/javascript/jquery/jquery.js '{}' \; - DH_VERBOSE=1 ../../dh_python3\ - --depends 'SQLAlchemy >= 0.6.1'\ - --recommends Mako\ - --suggests 'Foo >= 0.1'\ - --suggests 'bar >= 1.0' - -clean: - rm -rf build - dh clean - -override_dh_auto_build: - -override_dh_auto_clean: - #python3 setup.py clean diff -Nru python3-defaults-3.2.3/tests/t1/debian/source/format python3-defaults-3.4.0/tests/t1/debian/source/format --- python3-defaults-3.2.3/tests/t1/debian/source/format 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/tests/t1/debian/source/format 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -3.0 (native) diff -Nru python3-defaults-3.2.3/tests/t1/lib/foo/bar/__init__.py python3-defaults-3.4.0/tests/t1/lib/foo/bar/__init__.py --- python3-defaults-3.2.3/tests/t1/lib/foo/bar/__init__.py 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/tests/t1/lib/foo/bar/__init__.py 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -print("you just imported foo.bar from %s" % __file__) diff -Nru python3-defaults-3.2.3/tests/t1/lib/foo/baz.py python3-defaults-3.4.0/tests/t1/lib/foo/baz.py --- python3-defaults-3.2.3/tests/t1/lib/foo/baz.py 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/tests/t1/lib/foo/baz.py 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -print("you just imported foo.baz from %s" % __file__) diff -Nru python3-defaults-3.2.3/tests/t1/lib/foo/__init__.py python3-defaults-3.4.0/tests/t1/lib/foo/__init__.py --- python3-defaults-3.2.3/tests/t1/lib/foo/__init__.py 2012-03-16 21:25:25.000000000 +0000 +++ python3-defaults-3.4.0/tests/t1/lib/foo/__init__.py 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -print("you just imported foo from %s" % __file__) diff -Nru python3-defaults-3.2.3/tests/t1/lib/foo/jquery.js python3-defaults-3.4.0/tests/t1/lib/foo/jquery.js --- python3-defaults-3.2.3/tests/t1/lib/foo/jquery.js 2011-11-22 02:11:15.000000000 +0000 +++ python3-defaults-3.4.0/tests/t1/lib/foo/jquery.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,9266 +0,0 @@ -/*! - * jQuery JavaScript Library v1.7.1 - * http://jquery.com/ - * - * Copyright 2011, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Mon Nov 21 21:11:03 2011 -0500 - */ -(function( window, undefined ) { - -// Use the correct document accordingly with window argument (sandbox) -var document = window.document, - navigator = window.navigator, - location = window.location; -var jQuery = (function() { - -// Define a local copy of jQuery -var jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); - }, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // A central reference to the root jQuery(document) - rootjQuery, - - // A simple way to check for HTML strings or ID strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, - - // Check if a string has a non-whitespace character in it - rnotwhite = /\S/, - - // Used for trimming whitespace - trimLeft = /^\s+/, - trimRight = /\s+$/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, - - // JSON RegExp - rvalidchars = /^[\],:{}\s]*$/, - rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, - rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, - - // Useragent RegExp - rwebkit = /(webkit)[ \/]([\w.]+)/, - ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, - rmsie = /(msie) ([\w.]+)/, - rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, - - // Matches dashed string for camelizing - rdashAlpha = /-([a-z]|[0-9])/ig, - rmsPrefix = /^-ms-/, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return ( letter + "" ).toUpperCase(); - }, - - // Keep a UserAgent string for use with jQuery.browser - userAgent = navigator.userAgent, - - // For matching the engine and version of the browser - browserMatch, - - // The deferred used on DOM ready - readyList, - - // The ready event handler - DOMContentLoaded, - - // Save a reference to some core methods - toString = Object.prototype.toString, - hasOwn = Object.prototype.hasOwnProperty, - push = Array.prototype.push, - slice = Array.prototype.slice, - trim = String.prototype.trim, - indexOf = Array.prototype.indexOf, - - // [[Class]] -> type pairs - class2type = {}; - -jQuery.fn = jQuery.prototype = { - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem, ret, doc; - - // Handle $(""), $(null), or $(undefined) - if ( !selector ) { - return this; - } - - // Handle $(DOMElement) - if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - } - - // The body element only exists once, optimize finding it - if ( selector === "body" && !context && document.body ) { - this.context = document; - this[0] = document.body; - this.selector = selector; - this.length = 1; - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - // Are we dealing with HTML string or an ID? - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = quickExpr.exec( selector ); - } - - // Verify a match, and that no context was specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - doc = ( context ? context.ownerDocument || context : document ); - - // If a single string is passed in and it's a single tag - // just do a createElement and skip the rest - ret = rsingleTag.exec( selector ); - - if ( ret ) { - if ( jQuery.isPlainObject( context ) ) { - selector = [ document.createElement( ret[1] ) ]; - jQuery.fn.attr.call( selector, context, true ); - - } else { - selector = [ doc.createElement( ret[1] ) ]; - } - - } else { - ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); - selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes; - } - - return jQuery.merge( this, selector ); - - // HANDLE: $("#id") - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The current version of jQuery being used - jquery: "1.7.1", - - // The default length of a jQuery object is 0 - length: 0, - - // The number of elements contained in the matched element set - size: function() { - return this.length; - }, - - toArray: function() { - return slice.call( this, 0 ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems, name, selector ) { - // Build a new jQuery matched element set - var ret = this.constructor(); - - if ( jQuery.isArray( elems ) ) { - push.apply( ret, elems ); - - } else { - jQuery.merge( ret, elems ); - } - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - ret.context = this.context; - - if ( name === "find" ) { - ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; - } else if ( name ) { - ret.selector = this.selector + "." + name + "(" + selector + ")"; - } - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Attach the listeners - jQuery.bindReady(); - - // Add the callback - readyList.add( fn ); - - return this; - }, - - eq: function( i ) { - i = +i; - return i === -1 ? - this.slice( i ) : - this.slice( i, i + 1 ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ), - "slice", slice.call(arguments).join(",") ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - // Either a released hold or an DOMready/load event and not yet ready - if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready, 1 ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.fireWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger( "ready" ).off( "ready" ); - } - } - }, - - bindReady: function() { - if ( readyList ) { - return; - } - - readyList = jQuery.Callbacks( "once memory" ); - - // Catch cases where $(document).ready() is called after the - // browser event has already occurred. - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - return setTimeout( jQuery.ready, 1 ); - } - - // Mozilla, Opera and webkit nightlies currently support this event - if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", jQuery.ready, false ); - - // If IE event model is used - } else if ( document.attachEvent ) { - // ensure firing before onload, - // maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", DOMContentLoaded ); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", jQuery.ready ); - - // If IE and not a frame - // continually check to see if the document is ready - var toplevel = false; - - try { - toplevel = window.frameElement == null; - } catch(e) {} - - if ( document.documentElement.doScroll && toplevel ) { - doScrollCheck(); - } - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - // A crude way of determining if an object is a window - isWindow: function( obj ) { - return obj && typeof obj === "object" && "setInterval" in obj; - }, - - isNumeric: function( obj ) { - return !isNaN( parseFloat(obj) ) && isFinite( obj ); - }, - - type: function( obj ) { - return obj == null ? - String( obj ) : - class2type[ toString.call(obj) ] || "object"; - }, - - isPlainObject: function( obj ) { - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - try { - // Not own constructor property must be Object - if ( obj.constructor && - !hasOwn.call(obj, "constructor") && - !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - } catch ( e ) { - // IE8,9 Will throw exceptions on certain host objects #9897 - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - - var key; - for ( key in obj ) {} - - return key === undefined || hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - for ( var name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw new Error( msg ); - }, - - parseJSON: function( data ) { - if ( typeof data !== "string" || !data ) { - return null; - } - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return window.JSON.parse( data ); - } - - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) - .replace( rvalidtokens, "]" ) - .replace( rvalidbraces, "")) ) { - - return ( new Function( "return " + data ) )(); - - } - jQuery.error( "Invalid JSON: " + data ); - }, - - // Cross-browser xml parsing - parseXML: function( data ) { - var xml, tmp; - try { - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - } catch( e ) { - xml = undefined; - } - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; - }, - - noop: function() {}, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context - globalEval: function( data ) { - if ( data && rnotwhite.test( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); - }, - - // args is for internal usage only - each: function( object, callback, args ) { - var name, i = 0, - length = object.length, - isObj = length === undefined || jQuery.isFunction( object ); - - if ( args ) { - if ( isObj ) { - for ( name in object ) { - if ( callback.apply( object[ name ], args ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.apply( object[ i++ ], args ) === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isObj ) { - for ( name in object ) { - if ( callback.call( object[ name ], name, object[ name ] ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { - break; - } - } - } - } - - return object; - }, - - // Use native String.trim function wherever possible - trim: trim ? - function( text ) { - return text == null ? - "" : - trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); - }, - - // results is for internal usage only - makeArray: function( array, results ) { - var ret = results || []; - - if ( array != null ) { - // The window, strings (and functions) also have 'length' - // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 - var type = jQuery.type( array ); - - if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { - push.call( ret, array ); - } else { - jQuery.merge( ret, array ); - } - } - - return ret; - }, - - inArray: function( elem, array, i ) { - var len; - - if ( array ) { - if ( indexOf ) { - return indexOf.call( array, elem, i ); - } - - len = array.length; - i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; - - for ( ; i < len; i++ ) { - // Skip accessing in sparse arrays - if ( i in array && array[ i ] === elem ) { - return i; - } - } - } - - return -1; - }, - - merge: function( first, second ) { - var i = first.length, - j = 0; - - if ( typeof second.length === "number" ) { - for ( var l = second.length; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var ret = [], retVal; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( var i = 0, length = elems.length; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, key, ret = [], - i = 0, - length = elems.length, - // jquery objects are treated as arrays - isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; - - // Go through the array, translating each of the items to their - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - // Go through every key on the object, - } else { - for ( key in elems ) { - value = callback( elems[ key ], key, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - } - - // Flatten any nested arrays - return ret.concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - if ( typeof context === "string" ) { - var tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - var args = slice.call( arguments, 2 ), - proxy = function() { - return fn.apply( context, args.concat( slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; - - return proxy; - }, - - // Mutifunctional method to get and set values to a collection - // The value/s can optionally be executed if it's a function - access: function( elems, key, value, exec, fn, pass ) { - var length = elems.length; - - // Setting many attributes - if ( typeof key === "object" ) { - for ( var k in key ) { - jQuery.access( elems, k, key[k], exec, fn, value ); - } - return elems; - } - - // Setting one attribute - if ( value !== undefined ) { - // Optionally, function values get executed if exec is true - exec = !pass && exec && jQuery.isFunction(value); - - for ( var i = 0; i < length; i++ ) { - fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); - } - - return elems; - } - - // Getting an attribute - return length ? fn( elems[0], key ) : undefined; - }, - - now: function() { - return ( new Date() ).getTime(); - }, - - // Use of jQuery.browser is frowned upon. - // More details: http://docs.jquery.com/Utilities/jQuery.browser - uaMatch: function( ua ) { - ua = ua.toLowerCase(); - - var match = rwebkit.exec( ua ) || - ropera.exec( ua ) || - rmsie.exec( ua ) || - ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || - []; - - return { browser: match[1] || "", version: match[2] || "0" }; - }, - - sub: function() { - function jQuerySub( selector, context ) { - return new jQuerySub.fn.init( selector, context ); - } - jQuery.extend( true, jQuerySub, this ); - jQuerySub.superclass = this; - jQuerySub.fn = jQuerySub.prototype = this(); - jQuerySub.fn.constructor = jQuerySub; - jQuerySub.sub = this.sub; - jQuerySub.fn.init = function init( selector, context ) { - if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { - context = jQuerySub( context ); - } - - return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); - }; - jQuerySub.fn.init.prototype = jQuerySub.fn; - var rootjQuerySub = jQuerySub(document); - return jQuerySub; - }, - - browser: {} -}); - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -browserMatch = jQuery.uaMatch( userAgent ); -if ( browserMatch.browser ) { - jQuery.browser[ browserMatch.browser ] = true; - jQuery.browser.version = browserMatch.version; -} - -// Deprecated, use jQuery.browser.webkit instead -if ( jQuery.browser.webkit ) { - jQuery.browser.safari = true; -} - -// IE doesn't match non-breaking spaces with \s -if ( rnotwhite.test( "\xA0" ) ) { - trimLeft = /^[\s\xA0]+/; - trimRight = /[\s\xA0]+$/; -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); - -// Cleanup functions for the document ready method -if ( document.addEventListener ) { - DOMContentLoaded = function() { - document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - jQuery.ready(); - }; - -} else if ( document.attachEvent ) { - DOMContentLoaded = function() { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( document.readyState === "complete" ) { - document.detachEvent( "onreadystatechange", DOMContentLoaded ); - jQuery.ready(); - } - }; -} - -// The DOM ready check for Internet Explorer -function doScrollCheck() { - if ( jQuery.isReady ) { - return; - } - - try { - // If IE is used, use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - document.documentElement.doScroll("left"); - } catch(e) { - setTimeout( doScrollCheck, 1 ); - return; - } - - // and execute any waiting functions - jQuery.ready(); -} - -return jQuery; - -})(); - - -// String to Object flags format cache -var flagsCache = {}; - -// Convert String-formatted flags into Object-formatted ones and store in cache -function createFlags( flags ) { - var object = flagsCache[ flags ] = {}, - i, length; - flags = flags.split( /\s+/ ); - for ( i = 0, length = flags.length; i < length; i++ ) { - object[ flags[i] ] = true; - } - return object; -} - -/* - * Create a callback list using the following parameters: - * - * flags: an optional list of space-separated flags that will change how - * the callback list behaves - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible flags: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( flags ) { - - // Convert flags from String-formatted to Object-formatted - // (we check in cache first) - flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {}; - - var // Actual callback list - list = [], - // Stack of fire calls for repeatable lists - stack = [], - // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list is currently firing - firing, - // First callback to fire (used internally by add and fireWith) - firingStart, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, - // Add one or several callbacks to the list - add = function( args ) { - var i, - length, - elem, - type, - actual; - for ( i = 0, length = args.length; i < length; i++ ) { - elem = args[ i ]; - type = jQuery.type( elem ); - if ( type === "array" ) { - // Inspect recursively - add( elem ); - } else if ( type === "function" ) { - // Add if not in unique mode and callback is not in - if ( !flags.unique || !self.has( elem ) ) { - list.push( elem ); - } - } - } - }, - // Fire callbacks - fire = function( context, args ) { - args = args || []; - memory = !flags.memory || [ context, args ]; - firing = true; - firingIndex = firingStart || 0; - firingStart = 0; - firingLength = list.length; - for ( ; list && firingIndex < firingLength; firingIndex++ ) { - if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) { - memory = true; // Mark as halted - break; - } - } - firing = false; - if ( list ) { - if ( !flags.once ) { - if ( stack && stack.length ) { - memory = stack.shift(); - self.fireWith( memory[ 0 ], memory[ 1 ] ); - } - } else if ( memory === true ) { - self.disable(); - } else { - list = []; - } - } - }, - // Actual Callbacks object - self = { - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - var length = list.length; - add( arguments ); - // Do we need to add the callbacks to the - // current firing batch? - if ( firing ) { - firingLength = list.length; - // With memory, if we're not firing then - // we should call right away, unless previous - // firing was halted (stopOnFalse) - } else if ( memory && memory !== true ) { - firingStart = length; - fire( memory[ 0 ], memory[ 1 ] ); - } - } - return this; - }, - // Remove a callback from the list - remove: function() { - if ( list ) { - var args = arguments, - argIndex = 0, - argLength = args.length; - for ( ; argIndex < argLength ; argIndex++ ) { - for ( var i = 0; i < list.length; i++ ) { - if ( args[ argIndex ] === list[ i ] ) { - // Handle firingIndex and firingLength - if ( firing ) { - if ( i <= firingLength ) { - firingLength--; - if ( i <= firingIndex ) { - firingIndex--; - } - } - } - // Remove the element - list.splice( i--, 1 ); - // If we have some unicity property then - // we only need to do this once - if ( flags.unique ) { - break; - } - } - } - } - } - return this; - }, - // Control if a given callback is in the list - has: function( fn ) { - if ( list ) { - var i = 0, - length = list.length; - for ( ; i < length; i++ ) { - if ( fn === list[ i ] ) { - return true; - } - } - } - return false; - }, - // Remove all callbacks from the list - empty: function() { - list = []; - return this; - }, - // Have the list do nothing anymore - disable: function() { - list = stack = memory = undefined; - return this; - }, - // Is it disabled? - disabled: function() { - return !list; - }, - // Lock the list in its current state - lock: function() { - stack = undefined; - if ( !memory || memory === true ) { - self.disable(); - } - return this; - }, - // Is it locked? - locked: function() { - return !stack; - }, - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( stack ) { - if ( firing ) { - if ( !flags.once ) { - stack.push( [ context, args ] ); - } - } else if ( !( flags.once && memory ) ) { - fire( context, args ); - } - } - return this; - }, - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - // To know if the callbacks have already been called at least once - fired: function() { - return !!memory; - } - }; - - return self; -}; - - - - -var // Static reference to slice - sliceDeferred = [].slice; - -jQuery.extend({ - - Deferred: function( func ) { - var doneList = jQuery.Callbacks( "once memory" ), - failList = jQuery.Callbacks( "once memory" ), - progressList = jQuery.Callbacks( "memory" ), - state = "pending", - lists = { - resolve: doneList, - reject: failList, - notify: progressList - }, - promise = { - done: doneList.add, - fail: failList.add, - progress: progressList.add, - - state: function() { - return state; - }, - - // Deprecated - isResolved: doneList.fired, - isRejected: failList.fired, - - then: function( doneCallbacks, failCallbacks, progressCallbacks ) { - deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks ); - return this; - }, - always: function() { - deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); - return this; - }, - pipe: function( fnDone, fnFail, fnProgress ) { - return jQuery.Deferred(function( newDefer ) { - jQuery.each( { - done: [ fnDone, "resolve" ], - fail: [ fnFail, "reject" ], - progress: [ fnProgress, "notify" ] - }, function( handler, data ) { - var fn = data[ 0 ], - action = data[ 1 ], - returned; - if ( jQuery.isFunction( fn ) ) { - deferred[ handler ](function() { - returned = fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify ); - } else { - newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); - } - }); - } else { - deferred[ handler ]( newDefer[ action ] ); - } - }); - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - if ( obj == null ) { - obj = promise; - } else { - for ( var key in promise ) { - obj[ key ] = promise[ key ]; - } - } - return obj; - } - }, - deferred = promise.promise({}), - key; - - for ( key in lists ) { - deferred[ key ] = lists[ key ].fire; - deferred[ key + "With" ] = lists[ key ].fireWith; - } - - // Handle state - deferred.done( function() { - state = "resolved"; - }, failList.disable, progressList.lock ).fail( function() { - state = "rejected"; - }, doneList.disable, progressList.lock ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( firstParam ) { - var args = sliceDeferred.call( arguments, 0 ), - i = 0, - length = args.length, - pValues = new Array( length ), - count = length, - pCount = length, - deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? - firstParam : - jQuery.Deferred(), - promise = deferred.promise(); - function resolveFunc( i ) { - return function( value ) { - args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - if ( !( --count ) ) { - deferred.resolveWith( deferred, args ); - } - }; - } - function progressFunc( i ) { - return function( value ) { - pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - deferred.notifyWith( promise, pValues ); - }; - } - if ( length > 1 ) { - for ( ; i < length; i++ ) { - if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) { - args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) ); - } else { - --count; - } - } - if ( !count ) { - deferred.resolveWith( deferred, args ); - } - } else if ( deferred !== firstParam ) { - deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); - } - return promise; - } -}); - - - - -jQuery.support = (function() { - - var support, - all, - a, - select, - opt, - input, - marginDiv, - fragment, - tds, - events, - eventName, - i, - isSupported, - div = document.createElement( "div" ), - documentElement = document.documentElement; - - // Preliminary tests - div.setAttribute("className", "t"); - div.innerHTML = "
a"; - - all = div.getElementsByTagName( "*" ); - a = div.getElementsByTagName( "a" )[ 0 ]; - - // Can't get basic test support - if ( !all || !all.length || !a ) { - return {}; - } - - // First batch of supports tests - select = document.createElement( "select" ); - opt = select.appendChild( document.createElement("option") ); - input = div.getElementsByTagName( "input" )[ 0 ]; - - support = { - // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: ( div.firstChild.nodeType === 3 ), - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - tbody: !div.getElementsByTagName("tbody").length, - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - htmlSerialize: !!div.getElementsByTagName("link").length, - - // Get the style information from getAttribute - // (IE uses .cssText instead) - style: /top/.test( a.getAttribute("style") ), - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - hrefNormalized: ( a.getAttribute("href") === "/a" ), - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.55/.test( a.style.opacity ), - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - cssFloat: !!a.style.cssFloat, - - // Make sure that if no value is specified for a checkbox - // that it defaults to "on". - // (WebKit defaults to "" instead) - checkOn: ( input.value === "on" ), - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: opt.selected, - - // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) - getSetAttribute: div.className !== "t", - - // Tests for enctype support on a form(#6743) - enctype: !!document.createElement("form").enctype, - - // Makes sure cloning an html5 element does not cause problems - // Where outerHTML is undefined, this still works - html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", - - // Will be defined later - submitBubbles: true, - changeBubbles: true, - focusinBubbles: false, - deleteExpando: true, - noCloneEvent: true, - inlineBlockNeedsLayout: false, - shrinkWrapBlocks: false, - reliableMarginRight: true - }; - - // Make sure checked status is properly cloned - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; - - // Test to see if it's possible to delete an expando from an element - // Fails in Internet Explorer - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - - if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { - div.attachEvent( "onclick", function() { - // Cloning a node shouldn't copy over any - // bound event handlers (IE does this) - support.noCloneEvent = false; - }); - div.cloneNode( true ).fireEvent( "onclick" ); - } - - // Check if a radio maintains its value - // after being appended to the DOM - input = document.createElement("input"); - input.value = "t"; - input.setAttribute("type", "radio"); - support.radioValue = input.value === "t"; - - input.setAttribute("checked", "checked"); - div.appendChild( input ); - fragment = document.createDocumentFragment(); - fragment.appendChild( div.lastChild ); - - // WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - support.appendChecked = input.checked; - - fragment.removeChild( input ); - fragment.appendChild( div ); - - div.innerHTML = ""; - - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. For more - // info see bug #3333 - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - if ( window.getComputedStyle ) { - marginDiv = document.createElement( "div" ); - marginDiv.style.width = "0"; - marginDiv.style.marginRight = "0"; - div.style.width = "2px"; - div.appendChild( marginDiv ); - support.reliableMarginRight = - ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; - } - - // Technique from Juriy Zaytsev - // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ - // We only care about the case where non-standard event systems - // are used, namely in IE. Short-circuiting here helps us to - // avoid an eval call (in setAttribute) which can cause CSP - // to go haywire. See: https://developer.mozilla.org/en/Security/CSP - if ( div.attachEvent ) { - for( i in { - submit: 1, - change: 1, - focusin: 1 - }) { - eventName = "on" + i; - isSupported = ( eventName in div ); - if ( !isSupported ) { - div.setAttribute( eventName, "return;" ); - isSupported = ( typeof div[ eventName ] === "function" ); - } - support[ i + "Bubbles" ] = isSupported; - } - } - - fragment.removeChild( div ); - - // Null elements to avoid leaks in IE - fragment = select = opt = marginDiv = div = input = null; - - // Run tests that need a body at doc ready - jQuery(function() { - var container, outer, inner, table, td, offsetSupport, - conMarginTop, ptlm, vb, style, html, - body = document.getElementsByTagName("body")[0]; - - if ( !body ) { - // Return for frameset docs that don't have a body - return; - } - - conMarginTop = 1; - ptlm = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;"; - vb = "visibility:hidden;border:0;"; - style = "style='" + ptlm + "border:5px solid #000;padding:0;'"; - html = "
" + - "" + - "
"; - - container = document.createElement("div"); - container.style.cssText = vb + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px"; - body.insertBefore( container, body.firstChild ); - - // Construct the test element - div = document.createElement("div"); - container.appendChild( div ); - - // Check if table cells still have offsetWidth/Height when they are set - // to display:none and there are still other visible table cells in a - // table row; if so, offsetWidth/Height are not reliable for use when - // determining if an element has been hidden directly using - // display:none (it is still safe to use offsets if a parent element is - // hidden; don safety goggles and see bug #4512 for more information). - // (only IE 8 fails this test) - div.innerHTML = "
t
"; - tds = div.getElementsByTagName( "td" ); - isSupported = ( tds[ 0 ].offsetHeight === 0 ); - - tds[ 0 ].style.display = ""; - tds[ 1 ].style.display = "none"; - - // Check if empty table cells still have offsetWidth/Height - // (IE <= 8 fail this test) - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - - // Figure out if the W3C box model works as expected - div.innerHTML = ""; - div.style.width = div.style.paddingLeft = "1px"; - jQuery.boxModel = support.boxModel = div.offsetWidth === 2; - - if ( typeof div.style.zoom !== "undefined" ) { - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - // (IE < 8 does this) - div.style.display = "inline"; - div.style.zoom = 1; - support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 ); - - // Check if elements with layout shrink-wrap their children - // (IE 6 does this) - div.style.display = ""; - div.innerHTML = "
"; - support.shrinkWrapBlocks = ( div.offsetWidth !== 2 ); - } - - div.style.cssText = ptlm + vb; - div.innerHTML = html; - - outer = div.firstChild; - inner = outer.firstChild; - td = outer.nextSibling.firstChild.firstChild; - - offsetSupport = { - doesNotAddBorder: ( inner.offsetTop !== 5 ), - doesAddBorderForTableAndCells: ( td.offsetTop === 5 ) - }; - - inner.style.position = "fixed"; - inner.style.top = "20px"; - - // safari subtracts parent border width here which is 5px - offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 ); - inner.style.position = inner.style.top = ""; - - outer.style.overflow = "hidden"; - outer.style.position = "relative"; - - offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 ); - offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop ); - - body.removeChild( container ); - div = container = null; - - jQuery.extend( support, offsetSupport ); - }); - - return support; -})(); - - - - -var rbrace = /^(?:\{.*\}|\[.*\])$/, - rmultiDash = /([A-Z])/g; - -jQuery.extend({ - cache: {}, - - // Please use with caution - uuid: 0, - - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - // Ban all objects except for Flash (which handle expandos) - "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", - "applet": true - }, - - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - return !!elem && !isEmptyDataObject( elem ); - }, - - data: function( elem, name, data, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var privateCache, thisCache, ret, - internalKey = jQuery.expando, - getByName = typeof name === "string", - - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, - - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, - - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey, - isEvents = name === "events"; - - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) { - return; - } - - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - elem[ internalKey ] = id = ++jQuery.uuid; - } else { - id = internalKey; - } - } - - if ( !cache[ id ] ) { - cache[ id ] = {}; - - // Avoids exposing jQuery metadata on plain JS objects when the object - // is serialized using JSON.stringify - if ( !isNode ) { - cache[ id ].toJSON = jQuery.noop; - } - } - - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ] = jQuery.extend( cache[ id ], name ); - } else { - cache[ id ].data = jQuery.extend( cache[ id ].data, name ); - } - } - - privateCache = thisCache = cache[ id ]; - - // jQuery data() is stored in a separate object inside the object's internal data - // cache in order to avoid key collisions between internal data and user-defined - // data. - if ( !pvt ) { - if ( !thisCache.data ) { - thisCache.data = {}; - } - - thisCache = thisCache.data; - } - - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } - - // Users should not attempt to inspect the internal events object using jQuery.data, - // it is undocumented and subject to change. But does anyone listen? No. - if ( isEvents && !thisCache[ name ] ) { - return privateCache.events; - } - - // Check for both converted-to-camel and non-converted data property names - // If a data property was specified - if ( getByName ) { - - // First Try to find as-is property data - ret = thisCache[ name ]; - - // Test for null|undefined property data - if ( ret == null ) { - - // Try to find the camelCased property - ret = thisCache[ jQuery.camelCase( name ) ]; - } - } else { - ret = thisCache; - } - - return ret; - }, - - removeData: function( elem, name, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var thisCache, i, l, - - // Reference to internal data cache key - internalKey = jQuery.expando, - - isNode = elem.nodeType, - - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - - // See jQuery.data for more information - id = isNode ? elem[ internalKey ] : internalKey; - - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; - } - - if ( name ) { - - thisCache = pvt ? cache[ id ] : cache[ id ].data; - - if ( thisCache ) { - - // Support array or space separated string names for data keys - if ( !jQuery.isArray( name ) ) { - - // try the string as a key before any manipulation - if ( name in thisCache ) { - name = [ name ]; - } else { - - // split the camel cased version by spaces unless a key with the spaces exists - name = jQuery.camelCase( name ); - if ( name in thisCache ) { - name = [ name ]; - } else { - name = name.split( " " ); - } - } - } - - for ( i = 0, l = name.length; i < l; i++ ) { - delete thisCache[ name[i] ]; - } - - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { - return; - } - } - } - - // See jQuery.data for more information - if ( !pvt ) { - delete cache[ id ].data; - - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject(cache[ id ]) ) { - return; - } - } - - // Browsers that fail expando deletion also refuse to delete expandos on - // the window, but it will allow it on all other JS objects; other browsers - // don't care - // Ensure that `cache` is not a window object #10080 - if ( jQuery.support.deleteExpando || !cache.setInterval ) { - delete cache[ id ]; - } else { - cache[ id ] = null; - } - - // We destroyed the cache and need to eliminate the expando on the node to avoid - // false lookups in the cache for entries that no longer exist - if ( isNode ) { - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( jQuery.support.deleteExpando ) { - delete elem[ internalKey ]; - } else if ( elem.removeAttribute ) { - elem.removeAttribute( internalKey ); - } else { - elem[ internalKey ] = null; - } - } - }, - - // For internal use only. - _data: function( elem, name, data ) { - return jQuery.data( elem, name, data, true ); - }, - - // A method for determining if a DOM node can handle the data expando - acceptData: function( elem ) { - if ( elem.nodeName ) { - var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; - - if ( match ) { - return !(match === true || elem.getAttribute("classid") !== match); - } - } - - return true; - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - var parts, attr, name, - data = null; - - if ( typeof key === "undefined" ) { - if ( this.length ) { - data = jQuery.data( this[0] ); - - if ( this[0].nodeType === 1 && !jQuery._data( this[0], "parsedAttrs" ) ) { - attr = this[0].attributes; - for ( var i = 0, l = attr.length; i < l; i++ ) { - name = attr[i].name; - - if ( name.indexOf( "data-" ) === 0 ) { - name = jQuery.camelCase( name.substring(5) ); - - dataAttr( this[0], name, data[ name ] ); - } - } - jQuery._data( this[0], "parsedAttrs", true ); - } - } - - return data; - - } else if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - parts = key.split("."); - parts[1] = parts[1] ? "." + parts[1] : ""; - - if ( value === undefined ) { - data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); - - // Try to fetch any internally stored data first - if ( data === undefined && this.length ) { - data = jQuery.data( this[0], key ); - data = dataAttr( this[0], key, data ); - } - - return data === undefined && parts[1] ? - this.data( parts[0] ) : - data; - - } else { - return this.each(function() { - var self = jQuery( this ), - args = [ parts[0], value ]; - - self.triggerHandler( "setData" + parts[1] + "!", args ); - jQuery.data( this, key, value ); - self.triggerHandler( "changeData" + parts[1] + "!", args ); - }); - } - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); - -function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - - var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - jQuery.isNumeric( data ) ? parseFloat( data ) : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); - - } else { - data = undefined; - } - } - - return data; -} - -// checks a cache object for emptiness -function isEmptyDataObject( obj ) { - for ( var name in obj ) { - - // if the public data object is empty, the private is still empty - if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { - continue; - } - if ( name !== "toJSON" ) { - return false; - } - } - - return true; -} - - - - -function handleQueueMarkDefer( elem, type, src ) { - var deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - defer = jQuery._data( elem, deferDataKey ); - if ( defer && - ( src === "queue" || !jQuery._data(elem, queueDataKey) ) && - ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) { - // Give room for hard-coded callbacks to fire first - // and eventually mark/queue something else on the element - setTimeout( function() { - if ( !jQuery._data( elem, queueDataKey ) && - !jQuery._data( elem, markDataKey ) ) { - jQuery.removeData( elem, deferDataKey, true ); - defer.fire(); - } - }, 0 ); - } -} - -jQuery.extend({ - - _mark: function( elem, type ) { - if ( elem ) { - type = ( type || "fx" ) + "mark"; - jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 ); - } - }, - - _unmark: function( force, elem, type ) { - if ( force !== true ) { - type = elem; - elem = force; - force = false; - } - if ( elem ) { - type = type || "fx"; - var key = type + "mark", - count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 ); - if ( count ) { - jQuery._data( elem, key, count ); - } else { - jQuery.removeData( elem, key, true ); - handleQueueMarkDefer( elem, type, "mark" ); - } - } - }, - - queue: function( elem, type, data ) { - var q; - if ( elem ) { - type = ( type || "fx" ) + "queue"; - q = jQuery._data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !q || jQuery.isArray(data) ) { - q = jQuery._data( elem, type, jQuery.makeArray(data) ); - } else { - q.push( data ); - } - } - return q || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - fn = queue.shift(), - hooks = {}; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - } - - if ( fn ) { - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - jQuery._data( elem, type + ".run", hooks ); - fn.call( elem, function() { - jQuery.dequeue( elem, type ); - }, hooks ); - } - - if ( !queue.length ) { - jQuery.removeData( elem, type + "queue " + type + ".run", true ); - handleQueueMarkDefer( elem, type, "queue" ); - } - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - } - - if ( data === undefined ) { - return jQuery.queue( this[0], type ); - } - return this.each(function() { - var queue = jQuery.queue( this, type, data ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = setTimeout( next, time ); - hooks.stop = function() { - clearTimeout( timeout ); - }; - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, object ) { - if ( typeof type !== "string" ) { - object = type; - type = undefined; - } - type = type || "fx"; - var defer = jQuery.Deferred(), - elements = this, - i = elements.length, - count = 1, - deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - tmp; - function resolve() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - } - while( i-- ) { - if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || - ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || - jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && - jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) { - count++; - tmp.add( resolve ); - } - } - resolve(); - return defer.promise(); - } -}); - - - - -var rclass = /[\n\t\r]/g, - rspace = /\s+/, - rreturn = /\r/g, - rtype = /^(?:button|input)$/i, - rfocusable = /^(?:button|input|object|select|textarea)$/i, - rclickable = /^a(?:rea)?$/i, - rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, - getSetAttribute = jQuery.support.getSetAttribute, - nodeHook, boolHook, fixSpecified; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, name, value, true, jQuery.attr ); - }, - - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, - - prop: function( name, value ) { - return jQuery.access( this, name, value, true, jQuery.prop ); - }, - - removeProp: function( name ) { - name = jQuery.propFix[ name ] || name; - return this.each(function() { - // try/catch handles cases where IE balks (such as removing a property on window) - try { - this[ name ] = undefined; - delete this[ name ]; - } catch( e ) {} - }); - }, - - addClass: function( value ) { - var classNames, i, l, elem, - setClass, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call(this, j, this.className) ); - }); - } - - if ( value && typeof value === "string" ) { - classNames = value.split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 ) { - if ( !elem.className && classNames.length === 1 ) { - elem.className = value; - - } else { - setClass = " " + elem.className + " "; - - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { - setClass += classNames[ c ] + " "; - } - } - elem.className = jQuery.trim( setClass ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classNames, i, l, elem, className, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call(this, j, this.className) ); - }); - } - - if ( (value && typeof value === "string") || value === undefined ) { - classNames = ( value || "" ).split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 && elem.className ) { - if ( value ) { - className = (" " + elem.className + " ").replace( rclass, " " ); - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - className = className.replace(" " + classNames[ c ] + " ", " "); - } - elem.className = jQuery.trim( className ); - - } else { - elem.className = ""; - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isBool = typeof stateVal === "boolean"; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - state = stateVal, - classNames = value.split( rspace ); - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space seperated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); - } - - } else if ( type === "undefined" || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery._data( this, "__className__", this.className ); - } - - // toggle whole className - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " ", - i = 0, - l = this.length; - for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - var hooks, ret, isFunction, - elem = this[0]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ]; - - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } - - ret = elem.value; - - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } - - return; - } - - isFunction = jQuery.isFunction( value ); - - return this.each(function( i ) { - var self = jQuery(this), val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call( this, i, self.val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } - - hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // attributes.value is undefined in Blackberry 4.7 but - // uses .value. See #6932 - var val = elem.attributes.value; - return !val || val.specified ? elem.value : elem.text; - } - }, - select: { - get: function( elem ) { - var value, i, max, option, - index = elem.selectedIndex, - values = [], - options = elem.options, - one = elem.type === "select-one"; - - // Nothing was selected - if ( index < 0 ) { - return null; - } - - // Loop through all the selected options - i = one ? index : 0; - max = one ? index + 1 : options.length; - for ( ; i < max; i++ ) { - option = options[ i ]; - - // Don't return options that are disabled or in a disabled optgroup - if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && - (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - // Fixes Bug #2551 -- select.val() broken in IE after form.reset() - if ( one && !values.length && options.length ) { - return jQuery( options[ index ] ).val(); - } - - return values; - }, - - set: function( elem, value ) { - var values = jQuery.makeArray( value ); - - jQuery(elem).find("option").each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); - - if ( !values.length ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, - - attrFn: { - val: true, - css: true, - html: true, - text: true, - data: true, - width: true, - height: true, - offset: true - }, - - attr: function( elem, name, value, pass ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - if ( pass && name in jQuery.attrFn ) { - return jQuery( elem )[ name ]( value ); - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === "undefined" ) { - return jQuery.prop( elem, name, value ); - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - // All attributes are lowercase - // Grab necessary hook if one is defined - if ( notxml ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); - } - - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return; - - } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - elem.setAttribute( name, "" + value ); - return value; - } - - } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - - ret = elem.getAttribute( name ); - - // Non-existent attributes return null, we normalize to undefined - return ret === null ? - undefined : - ret; - } - }, - - removeAttr: function( elem, value ) { - var propName, attrNames, name, l, - i = 0; - - if ( value && elem.nodeType === 1 ) { - attrNames = value.toLowerCase().split( rspace ); - l = attrNames.length; - - for ( ; i < l; i++ ) { - name = attrNames[ i ]; - - if ( name ) { - propName = jQuery.propFix[ name ] || name; - - // See #9699 for explanation of this approach (setting first, then removal) - jQuery.attr( elem, name, "" ); - elem.removeAttribute( getSetAttribute ? name : propName ); - - // Set corresponding property to false for boolean attributes - if ( rboolean.test( name ) && propName in elem ) { - elem[ propName ] = false; - } - } - } - } - }, - - attrHooks: { - type: { - set: function( elem, value ) { - // We can't allow the type property to be changed (since it causes problems in IE) - if ( rtype.test( elem.nodeName ) && elem.parentNode ) { - jQuery.error( "type property can't be changed" ); - } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to it's default in case type is set after value - // This is for element creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - }, - // Use the value property for back compat - // Use the nodeHook for button elements in IE6/7 (#1954) - value: { - get: function( elem, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.get( elem, name ); - } - return name in elem ? - elem.value : - null; - }, - set: function( elem, value, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.set( elem, value, name ); - } - // Does not return so that setAttribute is also used - elem.value = value; - } - } - }, - - propFix: { - tabindex: "tabIndex", - readonly: "readOnly", - "for": "htmlFor", - "class": "className", - maxlength: "maxLength", - cellspacing: "cellSpacing", - cellpadding: "cellPadding", - rowspan: "rowSpan", - colspan: "colSpan", - usemap: "useMap", - frameborder: "frameBorder", - contenteditable: "contentEditable" - }, - - prop: function( elem, name, value ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - return ( elem[ name ] = value ); - } - - } else { - if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - return elem[ name ]; - } - } - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - var attributeNode = elem.getAttributeNode("tabindex"); - - return attributeNode && attributeNode.specified ? - parseInt( attributeNode.value, 10 ) : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; - } - } - } -}); - -// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional) -jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex; - -// Hook for boolean attributes -boolHook = { - get: function( elem, name ) { - // Align boolean attributes with corresponding properties - // Fall back to attribute presence where some booleans are not supported - var attrNode, - property = jQuery.prop( elem, name ); - return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? - name.toLowerCase() : - undefined; - }, - set: function( elem, value, name ) { - var propName; - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - // value is true since we know at this point it's type boolean and not false - // Set boolean attributes to the same name and set the DOM property - propName = jQuery.propFix[ name ] || name; - if ( propName in elem ) { - // Only set the IDL specifically if it already exists on the element - elem[ propName ] = true; - } - - elem.setAttribute( name, name.toLowerCase() ); - } - return name; - } -}; - -// IE6/7 do not support getting/setting some attributes with get/setAttribute -if ( !getSetAttribute ) { - - fixSpecified = { - name: true, - id: true - }; - - // Use this for any attribute in IE6/7 - // This fixes almost every IE6/7 issue - nodeHook = jQuery.valHooks.button = { - get: function( elem, name ) { - var ret; - ret = elem.getAttributeNode( name ); - return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ? - ret.nodeValue : - undefined; - }, - set: function( elem, value, name ) { - // Set the existing or create a new attribute node - var ret = elem.getAttributeNode( name ); - if ( !ret ) { - ret = document.createAttribute( name ); - elem.setAttributeNode( ret ); - } - return ( ret.nodeValue = value + "" ); - } - }; - - // Apply the nodeHook to tabindex - jQuery.attrHooks.tabindex.set = nodeHook.set; - - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }); - }); - - // Set contenteditable to false on removals(#10429) - // Setting to empty string throws an error as an invalid value - jQuery.attrHooks.contenteditable = { - get: nodeHook.get, - set: function( elem, value, name ) { - if ( value === "" ) { - value = "false"; - } - nodeHook.set( elem, value, name ); - } - }; -} - - -// Some attributes require a special call on IE -if ( !jQuery.support.hrefNormalized ) { - jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - get: function( elem ) { - var ret = elem.getAttribute( name, 2 ); - return ret === null ? undefined : ret; - } - }); - }); -} - -if ( !jQuery.support.style ) { - jQuery.attrHooks.style = { - get: function( elem ) { - // Return undefined in the case of empty string - // Normalize to lowercase since IE uppercases css property names - return elem.style.cssText.toLowerCase() || undefined; - }, - set: function( elem, value ) { - return ( elem.style.cssText = "" + value ); - } - }; -} - -// Safari mis-reports the default selected property of an option -// Accessing the parent's selectedIndex property fixes it -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { - get: function( elem ) { - var parent = elem.parentNode; - - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - return null; - } - }); -} - -// IE6/7 call enctype encoding -if ( !jQuery.support.enctype ) { - jQuery.propFix.enctype = "encoding"; -} - -// Radios and checkboxes getter/setter -if ( !jQuery.support.checkOn ) { - jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - get: function( elem ) { - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - } - }; - }); -} -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); - } - } - }); -}); - - - - -var rformElems = /^(?:textarea|input|select)$/i, - rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/, - rhoverHack = /\bhover(\.\S+)?\b/, - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|contextmenu)|click/, - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/, - quickParse = function( selector ) { - var quick = rquickIs.exec( selector ); - if ( quick ) { - // 0 1 2 3 - // [ _, tag, id, class ] - quick[1] = ( quick[1] || "" ).toLowerCase(); - quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" ); - } - return quick; - }, - quickIs = function( elem, m ) { - var attrs = elem.attributes || {}; - return ( - (!m[1] || elem.nodeName.toLowerCase() === m[1]) && - (!m[2] || (attrs.id || {}).value === m[2]) && - (!m[3] || m[3].test( (attrs[ "class" ] || {}).value )) - ); - }, - hoverHack = function( events ) { - return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); - }; - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - add: function( elem, types, handler, data, selector ) { - - var elemData, eventHandle, events, - t, tns, type, namespaces, handleObj, - handleObjIn, quick, handlers, special; - - // Don't attach events to noData or text/comment nodes (allow plain objects tho) - if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - events = elemData.events; - if ( !events ) { - elemData.events = events = {}; - } - eventHandle = elemData.handle; - if ( !eventHandle ) { - elemData.handle = eventHandle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; - }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; - } - - // Handle multiple events separated by a space - // jQuery(...).bind("mouseover mouseout", fn); - types = jQuery.trim( hoverHack(types) ).split( " " ); - for ( t = 0; t < types.length; t++ ) { - - tns = rtypenamespace.exec( types[t] ) || []; - type = tns[1]; - namespaces = ( tns[2] || "" ).split( "." ).sort(); - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend({ - type: type, - origType: tns[1], - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - quick: quickParse( selector ), - namespace: namespaces.join(".") - }, handleObjIn ); - - // Init the event handler queue if we're the first - handlers = events[ type ]; - if ( !handlers ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener/attachEvent if the special events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - global: {}, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var elemData = jQuery.hasData( elem ) && jQuery._data( elem ), - t, tns, type, origType, namespaces, origCount, - j, events, special, handle, eventType, handleObj; - - if ( !elemData || !(events = elemData.events) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = jQuery.trim( hoverHack( types || "" ) ).split(" "); - for ( t = 0; t < types.length; t++ ) { - tns = rtypenamespace.exec( types[t] ) || []; - type = origType = tns[1]; - namespaces = tns[2]; - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector? special.delegateType : special.bindType ) || type; - eventType = events[ type ] || []; - origCount = eventType.length; - namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null; - - // Remove matching events - for ( j = 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !namespaces || namespaces.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - eventType.splice( j--, 1 ); - - if ( handleObj.selector ) { - eventType.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( eventType.length === 0 && origCount !== eventType.length ) { - if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - handle = elemData.handle; - if ( handle ) { - handle.elem = null; - } - - // removeData also checks for emptiness and clears the expando if empty - // so use it instead of delete - jQuery.removeData( elem, [ "events", "handle" ], true ); - } - }, - - // Events that are safe to short-circuit if no handlers are attached. - // Native DOM events should not be added, they may have inline handlers. - customEvent: { - "getData": true, - "setData": true, - "changeData": true - }, - - trigger: function( event, data, elem, onlyHandlers ) { - // Don't do events on text and comment nodes - if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { - return; - } - - // Event object or event type - var type = event.type || event, - namespaces = [], - cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType; - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf( "!" ) >= 0 ) { - // Exclusive events trigger only for the exact event (no namespaces) - type = type.slice(0, -1); - exclusive = true; - } - - if ( type.indexOf( "." ) >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - - if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { - // No jQuery handlers for this event type, and it can't have inline handlers - return; - } - - // Caller can pass in an Event, Object, or just an event type string - event = typeof event === "object" ? - // jQuery.Event object - event[ jQuery.expando ] ? event : - // Object literal - new jQuery.Event( type, event ) : - // Just the event type (string) - new jQuery.Event( type ); - - event.type = type; - event.isTrigger = true; - event.exclusive = exclusive; - event.namespace = namespaces.join( "." ); - event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null; - ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; - - // Handle a global trigger - if ( !elem ) { - - // TODO: Stop taunting the data cache; remove global events and always attach to document - cache = jQuery.cache; - for ( i in cache ) { - if ( cache[ i ].events && cache[ i ].events[ type ] ) { - jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); - } - } - return; - } - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data != null ? jQuery.makeArray( data ) : []; - data.unshift( event ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - eventPath = [[ elem, special.bindType || type ]]; - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; - old = null; - for ( ; cur; cur = cur.parentNode ) { - eventPath.push([ cur, bubbleType ]); - old = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( old && old === elem.ownerDocument ) { - eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); - } - } - - // Fire handlers on the event path - for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { - - cur = eventPath[i][0]; - event.type = eventPath[i][1]; - - handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - // Note that this is a bare JS function and not a jQuery handler - handle = ontype && cur[ ontype ]; - if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) { - event.preventDefault(); - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && - !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction() check here because IE6/7 fails that test. - // Don't do default actions on window, that's where global variables be (#6170) - // IE<9 dies on focus/blur to hidden element (#1486) - if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - old = elem[ ontype ]; - - if ( old ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - elem[ type ](); - jQuery.event.triggered = undefined; - - if ( old ) { - elem[ ontype ] = old; - } - } - } - } - - return event.result; - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event || window.event ); - - var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), - delegateCount = handlers.delegateCount, - args = [].slice.call( arguments, 0 ), - run_all = !event.exclusive && !event.namespace, - handlerQueue = [], - i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[0] = event; - event.delegateTarget = this; - - // Determine handlers that should run if there are delegated events - // Avoid disabled elements in IE (#6911) and non-left-click bubbling in Firefox (#3861) - if ( delegateCount && !event.target.disabled && !(event.button && event.type === "click") ) { - - // Pregenerate a single jQuery object for reuse with .is() - jqcur = jQuery(this); - jqcur.context = this.ownerDocument || this; - - for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { - selMatch = {}; - matches = []; - jqcur[0] = cur; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - sel = handleObj.selector; - - if ( selMatch[ sel ] === undefined ) { - selMatch[ sel ] = ( - handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel ) - ); - } - if ( selMatch[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, matches: matches }); - } - } - } - - // Add the remaining (directly-bound) handlers - if ( handlers.length > delegateCount ) { - handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); - } - - // Run delegates first; they may want to stop propagation beneath us - for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { - matched = handlerQueue[ i ]; - event.currentTarget = matched.elem; - - for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { - handleObj = matched.matches[ j ]; - - // Triggered event must either 1) be non-exclusive and have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { - - event.data = handleObj.data; - event.handleObj = handleObj; - - ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) - .apply( matched.elem, args ); - - if ( ret !== undefined ) { - event.result = ret; - if ( ret === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - return event.result; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** - props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var eventDoc, doc, body, - button = original.button, - fromElement = original.fromElement; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && fromElement ) { - event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, - originalEvent = event, - fixHook = jQuery.event.fixHooks[ event.type ] || {}, - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = jQuery.Event( originalEvent ); - - for ( i = copy.length; i; ) { - prop = copy[ --i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Target should not be a text node (#504, Safari) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8) - if ( event.metaKey === undefined ) { - event.metaKey = event.ctrlKey; - } - - return fixHook.filter? fixHook.filter( event, originalEvent ) : event; - }, - - special: { - ready: { - // Make sure the ready event is setup - setup: jQuery.bindReady - }, - - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - - focus: { - delegateType: "focusin" - }, - blur: { - delegateType: "focusout" - }, - - beforeunload: { - setup: function( data, namespaces, eventHandle ) { - // We only want to do this special case on windows - if ( jQuery.isWindow( this ) ) { - this.onbeforeunload = eventHandle; - } - }, - - teardown: function( namespaces, eventHandle ) { - if ( this.onbeforeunload === eventHandle ) { - this.onbeforeunload = null; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } -}; - -// Some plugins are using, but it's undocumented/deprecated and will be removed. -// The 1.7 special event interface should provide all the hooks needed now. -jQuery.event.handle = jQuery.event.dispatch; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - if ( elem.detachEvent ) { - elem.detachEvent( "on" + type, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -function returnFalse() { - return false; -} -function returnTrue() { - return true; -} - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - preventDefault: function() { - this.isDefaultPrevented = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - - // if preventDefault exists run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // otherwise set the returnValue property of the original event to false (IE) - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - this.isPropagationStopped = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - // if stopPropagation exists run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - // otherwise set the cancelBubble property of the original event to true (IE) - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - }, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var target = this, - related = event.relatedTarget, - handleObj = event.handleObj, - selector = handleObj.selector, - ret; - - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -}); - -// IE submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Lazy-add a submit handler when a descendant form may potentially be submitted - jQuery.event.add( this, "click._submit keypress._submit", function( e ) { - // Node name check avoids a VML-related crash in IE (#9807) - var elem = e.target, - form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !form._submit_attached ) { - jQuery.event.add( form, "submit._submit", function( event ) { - // If form was submitted by the user, bubble the event up the tree - if ( this.parentNode && !event.isTrigger ) { - jQuery.event.simulate( "submit", this.parentNode, event, true ); - } - }); - form._submit_attached = true; - } - }); - // return undefined since we don't need an event listener - }, - - teardown: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Remove delegated handlers; cleanData eventually reaps submit handlers attached above - jQuery.event.remove( this, "._submit" ); - } - }; -} - -// IE change delegation and checkbox/radio fix -if ( !jQuery.support.changeBubbles ) { - - jQuery.event.special.change = { - - setup: function() { - - if ( rformElems.test( this.nodeName ) ) { - // IE doesn't fire change on a check/radio until blur; trigger it on click - // after a propertychange. Eat the blur-change in special.change.handle. - // This still fires onchange a second time for check/radio after blur. - if ( this.type === "checkbox" || this.type === "radio" ) { - jQuery.event.add( this, "propertychange._change", function( event ) { - if ( event.originalEvent.propertyName === "checked" ) { - this._just_changed = true; - } - }); - jQuery.event.add( this, "click._change", function( event ) { - if ( this._just_changed && !event.isTrigger ) { - this._just_changed = false; - jQuery.event.simulate( "change", this, event, true ); - } - }); - } - return false; - } - // Delegated event; lazy-add a change handler on descendant inputs - jQuery.event.add( this, "beforeactivate._change", function( e ) { - var elem = e.target; - - if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) { - jQuery.event.add( elem, "change._change", function( event ) { - if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { - jQuery.event.simulate( "change", this.parentNode, event, true ); - } - }); - elem._change_attached = true; - } - }); - }, - - handle: function( event ) { - var elem = event.target; - - // Swallow native change events from checkbox/radio, we already triggered them above - if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { - return event.handleObj.handler.apply( this, arguments ); - } - }, - - teardown: function() { - jQuery.event.remove( this, "._change" ); - - return rformElems.test( this.nodeName ); - } - }; -} - -// Create "bubbling" focus and blur events -if ( !jQuery.support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0, - handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - }); -} - -jQuery.fn.extend({ - - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var origFn, type; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - // ( types-Object, data ) - data = selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } - - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on.call( this, types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - var handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace? handleObj.type + "." + handleObj.namespace : handleObj.type, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( var type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, - - bind: function( types, data, fn ) { - return this.on( types, null, data, fn ); - }, - unbind: function( types, fn ) { - return this.off( types, null, fn ); - }, - - live: function( types, data, fn ) { - jQuery( this.context ).on( types, this.selector, data, fn ); - return this; - }, - die: function( types, fn ) { - jQuery( this.context ).off( types, this.selector || "**", fn ); - return this; - }, - - delegate: function( selector, types, data, fn ) { - return this.on( types, selector, data, fn ); - }, - undelegate: function( selector, types, fn ) { - // ( namespace ) or ( selector, types [, fn] ) - return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn ); - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - if ( this[0] ) { - return jQuery.event.trigger( type, data, this[0], true ); - } - }, - - toggle: function( fn ) { - // Save reference to arguments for access in closure - var args = arguments, - guid = fn.guid || jQuery.guid++, - i = 0, - toggler = function( event ) { - // Figure out which function to execute - var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; - jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); - - // Make sure that clicks stop - event.preventDefault(); - - // and execute the function - return args[ lastToggle ].apply( this, arguments ) || false; - }; - - // link all the functions, so any of them can unbind this click handler - toggler.guid = guid; - while ( i < args.length ) { - args[ i++ ].guid = guid; - } - - return this.click( toggler ); - }, - - hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); - } -}); - -jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + - "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + - "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { - - // Handle event binding - jQuery.fn[ name ] = function( data, fn ) { - if ( fn == null ) { - fn = data; - data = null; - } - - return arguments.length > 0 ? - this.on( name, null, data, fn ) : - this.trigger( name ); - }; - - if ( jQuery.attrFn ) { - jQuery.attrFn[ name ] = true; - } - - if ( rkeyEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; - } - - if ( rmouseEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; - } -}); - - - -/*! - * Sizzle CSS Selector Engine - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){ - -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, - expando = "sizcache" + (Math.random() + '').replace('.', ''), - done = 0, - toString = Object.prototype.toString, - hasDuplicate = false, - baseHasDuplicate = true, - rBackslash = /\\/g, - rReturn = /\r\n/g, - rNonWord = /\W/; - -// Here we check if the JavaScript engine is using some sort of -// optimization where it does not always call our comparision -// function. If that is the case, discard the hasDuplicate value. -// Thus far that includes Google Chrome. -[0, 0].sort(function() { - baseHasDuplicate = false; - return 0; -}); - -var Sizzle = function( selector, context, results, seed ) { - results = results || []; - context = context || document; - - var origContext = context; - - if ( context.nodeType !== 1 && context.nodeType !== 9 ) { - return []; - } - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - var m, set, checkSet, extra, ret, cur, pop, i, - prune = true, - contextXML = Sizzle.isXML( context ), - parts = [], - soFar = selector; - - // Reset the position of the chunker regexp (start from head) - do { - chunker.exec( "" ); - m = chunker.exec( soFar ); - - if ( m ) { - soFar = m[3]; - - parts.push( m[1] ); - - if ( m[2] ) { - extra = m[3]; - break; - } - } - } while ( m ); - - if ( parts.length > 1 && origPOS.exec( selector ) ) { - - if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { - set = posProcess( parts[0] + parts[1], context, seed ); - - } else { - set = Expr.relative[ parts[0] ] ? - [ context ] : - Sizzle( parts.shift(), context ); - - while ( parts.length ) { - selector = parts.shift(); - - if ( Expr.relative[ selector ] ) { - selector += parts.shift(); - } - - set = posProcess( selector, set, seed ); - } - } - - } else { - // Take a shortcut and set the context if the root selector is an ID - // (but not if it'll be faster if the inner selector is an ID) - if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && - Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { - - ret = Sizzle.find( parts.shift(), context, contextXML ); - context = ret.expr ? - Sizzle.filter( ret.expr, ret.set )[0] : - ret.set[0]; - } - - if ( context ) { - ret = seed ? - { expr: parts.pop(), set: makeArray(seed) } : - Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); - - set = ret.expr ? - Sizzle.filter( ret.expr, ret.set ) : - ret.set; - - if ( parts.length > 0 ) { - checkSet = makeArray( set ); - - } else { - prune = false; - } - - while ( parts.length ) { - cur = parts.pop(); - pop = cur; - - if ( !Expr.relative[ cur ] ) { - cur = ""; - } else { - pop = parts.pop(); - } - - if ( pop == null ) { - pop = context; - } - - Expr.relative[ cur ]( checkSet, pop, contextXML ); - } - - } else { - checkSet = parts = []; - } - } - - if ( !checkSet ) { - checkSet = set; - } - - if ( !checkSet ) { - Sizzle.error( cur || selector ); - } - - if ( toString.call(checkSet) === "[object Array]" ) { - if ( !prune ) { - results.push.apply( results, checkSet ); - - } else if ( context && context.nodeType === 1 ) { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { - results.push( set[i] ); - } - } - - } else { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && checkSet[i].nodeType === 1 ) { - results.push( set[i] ); - } - } - } - - } else { - makeArray( checkSet, results ); - } - - if ( extra ) { - Sizzle( extra, origContext, results, seed ); - Sizzle.uniqueSort( results ); - } - - return results; -}; - -Sizzle.uniqueSort = function( results ) { - if ( sortOrder ) { - hasDuplicate = baseHasDuplicate; - results.sort( sortOrder ); - - if ( hasDuplicate ) { - for ( var i = 1; i < results.length; i++ ) { - if ( results[i] === results[ i - 1 ] ) { - results.splice( i--, 1 ); - } - } - } - } - - return results; -}; - -Sizzle.matches = function( expr, set ) { - return Sizzle( expr, null, null, set ); -}; - -Sizzle.matchesSelector = function( node, expr ) { - return Sizzle( expr, null, null, [node] ).length > 0; -}; - -Sizzle.find = function( expr, context, isXML ) { - var set, i, len, match, type, left; - - if ( !expr ) { - return []; - } - - for ( i = 0, len = Expr.order.length; i < len; i++ ) { - type = Expr.order[i]; - - if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { - left = match[1]; - match.splice( 1, 1 ); - - if ( left.substr( left.length - 1 ) !== "\\" ) { - match[1] = (match[1] || "").replace( rBackslash, "" ); - set = Expr.find[ type ]( match, context, isXML ); - - if ( set != null ) { - expr = expr.replace( Expr.match[ type ], "" ); - break; - } - } - } - } - - if ( !set ) { - set = typeof context.getElementsByTagName !== "undefined" ? - context.getElementsByTagName( "*" ) : - []; - } - - return { set: set, expr: expr }; -}; - -Sizzle.filter = function( expr, set, inplace, not ) { - var match, anyFound, - type, found, item, filter, left, - i, pass, - old = expr, - result = [], - curLoop = set, - isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); - - while ( expr && set.length ) { - for ( type in Expr.filter ) { - if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { - filter = Expr.filter[ type ]; - left = match[1]; - - anyFound = false; - - match.splice(1,1); - - if ( left.substr( left.length - 1 ) === "\\" ) { - continue; - } - - if ( curLoop === result ) { - result = []; - } - - if ( Expr.preFilter[ type ] ) { - match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); - - if ( !match ) { - anyFound = found = true; - - } else if ( match === true ) { - continue; - } - } - - if ( match ) { - for ( i = 0; (item = curLoop[i]) != null; i++ ) { - if ( item ) { - found = filter( item, match, i, curLoop ); - pass = not ^ found; - - if ( inplace && found != null ) { - if ( pass ) { - anyFound = true; - - } else { - curLoop[i] = false; - } - - } else if ( pass ) { - result.push( item ); - anyFound = true; - } - } - } - } - - if ( found !== undefined ) { - if ( !inplace ) { - curLoop = result; - } - - expr = expr.replace( Expr.match[ type ], "" ); - - if ( !anyFound ) { - return []; - } - - break; - } - } - } - - // Improper expression - if ( expr === old ) { - if ( anyFound == null ) { - Sizzle.error( expr ); - - } else { - break; - } - } - - old = expr; - } - - return curLoop; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Utility function for retreiving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -var getText = Sizzle.getText = function( elem ) { - var i, node, - nodeType = elem.nodeType, - ret = ""; - - if ( nodeType ) { - if ( nodeType === 1 || nodeType === 9 ) { - // Use textContent || innerText for elements - if ( typeof elem.textContent === 'string' ) { - return elem.textContent; - } else if ( typeof elem.innerText === 'string' ) { - // Replace IE's carriage returns - return elem.innerText.replace( rReturn, '' ); - } else { - // Traverse it's children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - } else { - - // If no nodeType, this is expected to be an array - for ( i = 0; (node = elem[i]); i++ ) { - // Do not traverse comment nodes - if ( node.nodeType !== 8 ) { - ret += getText( node ); - } - } - } - return ret; -}; - -var Expr = Sizzle.selectors = { - order: [ "ID", "NAME", "TAG" ], - - match: { - ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, - TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, - CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, - POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, - PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ - }, - - leftMatch: {}, - - attrMap: { - "class": "className", - "for": "htmlFor" - }, - - attrHandle: { - href: function( elem ) { - return elem.getAttribute( "href" ); - }, - type: function( elem ) { - return elem.getAttribute( "type" ); - } - }, - - relative: { - "+": function(checkSet, part){ - var isPartStr = typeof part === "string", - isTag = isPartStr && !rNonWord.test( part ), - isPartStrNotTag = isPartStr && !isTag; - - if ( isTag ) { - part = part.toLowerCase(); - } - - for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { - if ( (elem = checkSet[i]) ) { - while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} - - checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? - elem || false : - elem === part; - } - } - - if ( isPartStrNotTag ) { - Sizzle.filter( part, checkSet, true ); - } - }, - - ">": function( checkSet, part ) { - var elem, - isPartStr = typeof part === "string", - i = 0, - l = checkSet.length; - - if ( isPartStr && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - var parent = elem.parentNode; - checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; - } - } - - } else { - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - checkSet[i] = isPartStr ? - elem.parentNode : - elem.parentNode === part; - } - } - - if ( isPartStr ) { - Sizzle.filter( part, checkSet, true ); - } - } - }, - - "": function(checkSet, part, isXML){ - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); - }, - - "~": function( checkSet, part, isXML ) { - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); - } - }, - - find: { - ID: function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - }, - - NAME: function( match, context ) { - if ( typeof context.getElementsByName !== "undefined" ) { - var ret = [], - results = context.getElementsByName( match[1] ); - - for ( var i = 0, l = results.length; i < l; i++ ) { - if ( results[i].getAttribute("name") === match[1] ) { - ret.push( results[i] ); - } - } - - return ret.length === 0 ? null : ret; - } - }, - - TAG: function( match, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( match[1] ); - } - } - }, - preFilter: { - CLASS: function( match, curLoop, inplace, result, not, isXML ) { - match = " " + match[1].replace( rBackslash, "" ) + " "; - - if ( isXML ) { - return match; - } - - for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { - if ( elem ) { - if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { - if ( !inplace ) { - result.push( elem ); - } - - } else if ( inplace ) { - curLoop[i] = false; - } - } - } - - return false; - }, - - ID: function( match ) { - return match[1].replace( rBackslash, "" ); - }, - - TAG: function( match, curLoop ) { - return match[1].replace( rBackslash, "" ).toLowerCase(); - }, - - CHILD: function( match ) { - if ( match[1] === "nth" ) { - if ( !match[2] ) { - Sizzle.error( match[0] ); - } - - match[2] = match[2].replace(/^\+|\s*/g, ''); - - // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' - var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( - match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || - !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); - - // calculate the numbers (first)n+(last) including if they are negative - match[2] = (test[1] + (test[2] || 1)) - 0; - match[3] = test[3] - 0; - } - else if ( match[2] ) { - Sizzle.error( match[0] ); - } - - // TODO: Move to normal caching system - match[0] = done++; - - return match; - }, - - ATTR: function( match, curLoop, inplace, result, not, isXML ) { - var name = match[1] = match[1].replace( rBackslash, "" ); - - if ( !isXML && Expr.attrMap[name] ) { - match[1] = Expr.attrMap[name]; - } - - // Handle if an un-quoted value was used - match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); - - if ( match[2] === "~=" ) { - match[4] = " " + match[4] + " "; - } - - return match; - }, - - PSEUDO: function( match, curLoop, inplace, result, not ) { - if ( match[1] === "not" ) { - // If we're dealing with a complex expression, or a simple one - if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { - match[3] = Sizzle(match[3], null, null, curLoop); - - } else { - var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); - - if ( !inplace ) { - result.push.apply( result, ret ); - } - - return false; - } - - } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { - return true; - } - - return match; - }, - - POS: function( match ) { - match.unshift( true ); - - return match; - } - }, - - filters: { - enabled: function( elem ) { - return elem.disabled === false && elem.type !== "hidden"; - }, - - disabled: function( elem ) { - return elem.disabled === true; - }, - - checked: function( elem ) { - return elem.checked === true; - }, - - selected: function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - parent: function( elem ) { - return !!elem.firstChild; - }, - - empty: function( elem ) { - return !elem.firstChild; - }, - - has: function( elem, i, match ) { - return !!Sizzle( match[3], elem ).length; - }, - - header: function( elem ) { - return (/h\d/i).test( elem.nodeName ); - }, - - text: function( elem ) { - var attr = elem.getAttribute( "type" ), type = elem.type; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); - }, - - radio: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; - }, - - checkbox: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; - }, - - file: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; - }, - - password: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; - }, - - submit: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "submit" === elem.type; - }, - - image: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; - }, - - reset: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "reset" === elem.type; - }, - - button: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && "button" === elem.type || name === "button"; - }, - - input: function( elem ) { - return (/input|select|textarea|button/i).test( elem.nodeName ); - }, - - focus: function( elem ) { - return elem === elem.ownerDocument.activeElement; - } - }, - setFilters: { - first: function( elem, i ) { - return i === 0; - }, - - last: function( elem, i, match, array ) { - return i === array.length - 1; - }, - - even: function( elem, i ) { - return i % 2 === 0; - }, - - odd: function( elem, i ) { - return i % 2 === 1; - }, - - lt: function( elem, i, match ) { - return i < match[3] - 0; - }, - - gt: function( elem, i, match ) { - return i > match[3] - 0; - }, - - nth: function( elem, i, match ) { - return match[3] - 0 === i; - }, - - eq: function( elem, i, match ) { - return match[3] - 0 === i; - } - }, - filter: { - PSEUDO: function( elem, match, i, array ) { - var name = match[1], - filter = Expr.filters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - - } else if ( name === "contains" ) { - return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; - - } else if ( name === "not" ) { - var not = match[3]; - - for ( var j = 0, l = not.length; j < l; j++ ) { - if ( not[j] === elem ) { - return false; - } - } - - return true; - - } else { - Sizzle.error( name ); - } - }, - - CHILD: function( elem, match ) { - var first, last, - doneName, parent, cache, - count, diff, - type = match[1], - node = elem; - - switch ( type ) { - case "only": - case "first": - while ( (node = node.previousSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - if ( type === "first" ) { - return true; - } - - node = elem; - - case "last": - while ( (node = node.nextSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - return true; - - case "nth": - first = match[2]; - last = match[3]; - - if ( first === 1 && last === 0 ) { - return true; - } - - doneName = match[0]; - parent = elem.parentNode; - - if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) { - count = 0; - - for ( node = parent.firstChild; node; node = node.nextSibling ) { - if ( node.nodeType === 1 ) { - node.nodeIndex = ++count; - } - } - - parent[ expando ] = doneName; - } - - diff = elem.nodeIndex - last; - - if ( first === 0 ) { - return diff === 0; - - } else { - return ( diff % first === 0 && diff / first >= 0 ); - } - } - }, - - ID: function( elem, match ) { - return elem.nodeType === 1 && elem.getAttribute("id") === match; - }, - - TAG: function( elem, match ) { - return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match; - }, - - CLASS: function( elem, match ) { - return (" " + (elem.className || elem.getAttribute("class")) + " ") - .indexOf( match ) > -1; - }, - - ATTR: function( elem, match ) { - var name = match[1], - result = Sizzle.attr ? - Sizzle.attr( elem, name ) : - Expr.attrHandle[ name ] ? - Expr.attrHandle[ name ]( elem ) : - elem[ name ] != null ? - elem[ name ] : - elem.getAttribute( name ), - value = result + "", - type = match[2], - check = match[4]; - - return result == null ? - type === "!=" : - !type && Sizzle.attr ? - result != null : - type === "=" ? - value === check : - type === "*=" ? - value.indexOf(check) >= 0 : - type === "~=" ? - (" " + value + " ").indexOf(check) >= 0 : - !check ? - value && result !== false : - type === "!=" ? - value !== check : - type === "^=" ? - value.indexOf(check) === 0 : - type === "$=" ? - value.substr(value.length - check.length) === check : - type === "|=" ? - value === check || value.substr(0, check.length + 1) === check + "-" : - false; - }, - - POS: function( elem, match, i, array ) { - var name = match[2], - filter = Expr.setFilters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } - } - } -}; - -var origPOS = Expr.match.POS, - fescape = function(all, num){ - return "\\" + (num - 0 + 1); - }; - -for ( var type in Expr.match ) { - Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); - Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); -} - -var makeArray = function( array, results ) { - array = Array.prototype.slice.call( array, 0 ); - - if ( results ) { - results.push.apply( results, array ); - return results; - } - - return array; -}; - -// Perform a simple check to determine if the browser is capable of -// converting a NodeList to an array using builtin methods. -// Also verifies that the returned array holds DOM nodes -// (which is not the case in the Blackberry browser) -try { - Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; - -// Provide a fallback method if it does not work -} catch( e ) { - makeArray = function( array, results ) { - var i = 0, - ret = results || []; - - if ( toString.call(array) === "[object Array]" ) { - Array.prototype.push.apply( ret, array ); - - } else { - if ( typeof array.length === "number" ) { - for ( var l = array.length; i < l; i++ ) { - ret.push( array[i] ); - } - - } else { - for ( ; array[i]; i++ ) { - ret.push( array[i] ); - } - } - } - - return ret; - }; -} - -var sortOrder, siblingCheck; - -if ( document.documentElement.compareDocumentPosition ) { - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { - return a.compareDocumentPosition ? -1 : 1; - } - - return a.compareDocumentPosition(b) & 4 ? -1 : 1; - }; - -} else { - sortOrder = function( a, b ) { - // The nodes are identical, we can exit early - if ( a === b ) { - hasDuplicate = true; - return 0; - - // Fallback to using sourceIndex (in IE) if it's available on both nodes - } else if ( a.sourceIndex && b.sourceIndex ) { - return a.sourceIndex - b.sourceIndex; - } - - var al, bl, - ap = [], - bp = [], - aup = a.parentNode, - bup = b.parentNode, - cur = aup; - - // If the nodes are siblings (or identical) we can do a quick check - if ( aup === bup ) { - return siblingCheck( a, b ); - - // If no parents were found then the nodes are disconnected - } else if ( !aup ) { - return -1; - - } else if ( !bup ) { - return 1; - } - - // Otherwise they're somewhere else in the tree so we need - // to build up a full list of the parentNodes for comparison - while ( cur ) { - ap.unshift( cur ); - cur = cur.parentNode; - } - - cur = bup; - - while ( cur ) { - bp.unshift( cur ); - cur = cur.parentNode; - } - - al = ap.length; - bl = bp.length; - - // Start walking down the tree looking for a discrepancy - for ( var i = 0; i < al && i < bl; i++ ) { - if ( ap[i] !== bp[i] ) { - return siblingCheck( ap[i], bp[i] ); - } - } - - // We ended someplace up the tree so do a sibling check - return i === al ? - siblingCheck( a, bp[i], -1 ) : - siblingCheck( ap[i], b, 1 ); - }; - - siblingCheck = function( a, b, ret ) { - if ( a === b ) { - return ret; - } - - var cur = a.nextSibling; - - while ( cur ) { - if ( cur === b ) { - return -1; - } - - cur = cur.nextSibling; - } - - return 1; - }; -} - -// Check to see if the browser returns elements by name when -// querying by getElementById (and provide a workaround) -(function(){ - // We're going to inject a fake input element with a specified name - var form = document.createElement("div"), - id = "script" + (new Date()).getTime(), - root = document.documentElement; - - form.innerHTML = ""; - - // Inject it into the root element, check its status, and remove it quickly - root.insertBefore( form, root.firstChild ); - - // The workaround has to do additional checks after a getElementById - // Which slows things down for other browsers (hence the branching) - if ( document.getElementById( id ) ) { - Expr.find.ID = function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - - return m ? - m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? - [m] : - undefined : - []; - } - }; - - Expr.filter.ID = function( elem, match ) { - var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); - - return elem.nodeType === 1 && node && node.nodeValue === match; - }; - } - - root.removeChild( form ); - - // release memory in IE - root = form = null; -})(); - -(function(){ - // Check to see if the browser returns only elements - // when doing getElementsByTagName("*") - - // Create a fake element - var div = document.createElement("div"); - div.appendChild( document.createComment("") ); - - // Make sure no comments are found - if ( div.getElementsByTagName("*").length > 0 ) { - Expr.find.TAG = function( match, context ) { - var results = context.getElementsByTagName( match[1] ); - - // Filter out possible comments - if ( match[1] === "*" ) { - var tmp = []; - - for ( var i = 0; results[i]; i++ ) { - if ( results[i].nodeType === 1 ) { - tmp.push( results[i] ); - } - } - - results = tmp; - } - - return results; - }; - } - - // Check to see if an attribute returns normalized href attributes - div.innerHTML = ""; - - if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && - div.firstChild.getAttribute("href") !== "#" ) { - - Expr.attrHandle.href = function( elem ) { - return elem.getAttribute( "href", 2 ); - }; - } - - // release memory in IE - div = null; -})(); - -if ( document.querySelectorAll ) { - (function(){ - var oldSizzle = Sizzle, - div = document.createElement("div"), - id = "__sizzle__"; - - div.innerHTML = "

"; - - // Safari can't handle uppercase or unicode characters when - // in quirks mode. - if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { - return; - } - - Sizzle = function( query, context, extra, seed ) { - context = context || document; - - // Only use querySelectorAll on non-XML documents - // (ID selectors don't work in non-HTML documents) - if ( !seed && !Sizzle.isXML(context) ) { - // See if we find a selector to speed up - var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); - - if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { - // Speed-up: Sizzle("TAG") - if ( match[1] ) { - return makeArray( context.getElementsByTagName( query ), extra ); - - // Speed-up: Sizzle(".CLASS") - } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { - return makeArray( context.getElementsByClassName( match[2] ), extra ); - } - } - - if ( context.nodeType === 9 ) { - // Speed-up: Sizzle("body") - // The body element only exists once, optimize finding it - if ( query === "body" && context.body ) { - return makeArray( [ context.body ], extra ); - - // Speed-up: Sizzle("#ID") - } else if ( match && match[3] ) { - var elem = context.getElementById( match[3] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id === match[3] ) { - return makeArray( [ elem ], extra ); - } - - } else { - return makeArray( [], extra ); - } - } - - try { - return makeArray( context.querySelectorAll(query), extra ); - } catch(qsaError) {} - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - var oldContext = context, - old = context.getAttribute( "id" ), - nid = old || id, - hasParent = context.parentNode, - relativeHierarchySelector = /^\s*[+~]/.test( query ); - - if ( !old ) { - context.setAttribute( "id", nid ); - } else { - nid = nid.replace( /'/g, "\\$&" ); - } - if ( relativeHierarchySelector && hasParent ) { - context = context.parentNode; - } - - try { - if ( !relativeHierarchySelector || hasParent ) { - return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); - } - - } catch(pseudoError) { - } finally { - if ( !old ) { - oldContext.removeAttribute( "id" ); - } - } - } - } - - return oldSizzle(query, context, extra, seed); - }; - - for ( var prop in oldSizzle ) { - Sizzle[ prop ] = oldSizzle[ prop ]; - } - - // release memory in IE - div = null; - })(); -} - -(function(){ - var html = document.documentElement, - matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; - - if ( matches ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9 fails this) - var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), - pseudoWorks = false; - - try { - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( document.documentElement, "[test!='']:sizzle" ); - - } catch( pseudoError ) { - pseudoWorks = true; - } - - Sizzle.matchesSelector = function( node, expr ) { - // Make sure that attribute selectors are quoted - expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); - - if ( !Sizzle.isXML( node ) ) { - try { - if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { - var ret = matches.call( node, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || !disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9, so check for that - node.document && node.document.nodeType !== 11 ) { - return ret; - } - } - } catch(e) {} - } - - return Sizzle(expr, null, null, [node]).length > 0; - }; - } -})(); - -(function(){ - var div = document.createElement("div"); - - div.innerHTML = "
"; - - // Opera can't find a second classname (in 9.6) - // Also, make sure that getElementsByClassName actually exists - if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { - return; - } - - // Safari caches class attributes, doesn't catch changes (in 3.2) - div.lastChild.className = "e"; - - if ( div.getElementsByClassName("e").length === 1 ) { - return; - } - - Expr.order.splice(1, 0, "CLASS"); - Expr.find.CLASS = function( match, context, isXML ) { - if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { - return context.getElementsByClassName(match[1]); - } - }; - - // release memory in IE - div = null; -})(); - -function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 && !isXML ){ - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( elem.nodeName.toLowerCase() === cur ) { - match = elem; - break; - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 ) { - if ( !isXML ) { - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( typeof cur !== "string" ) { - if ( elem === cur ) { - match = true; - break; - } - - } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { - match = elem; - break; - } - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -if ( document.documentElement.contains ) { - Sizzle.contains = function( a, b ) { - return a !== b && (a.contains ? a.contains(b) : true); - }; - -} else if ( document.documentElement.compareDocumentPosition ) { - Sizzle.contains = function( a, b ) { - return !!(a.compareDocumentPosition(b) & 16); - }; - -} else { - Sizzle.contains = function() { - return false; - }; -} - -Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; - - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -var posProcess = function( selector, context, seed ) { - var match, - tmpSet = [], - later = "", - root = context.nodeType ? [context] : context; - - // Position selectors must be done after the filter - // And so must :not(positional) so we move all PSEUDOs to the end - while ( (match = Expr.match.PSEUDO.exec( selector )) ) { - later += match[0]; - selector = selector.replace( Expr.match.PSEUDO, "" ); - } - - selector = Expr.relative[selector] ? selector + "*" : selector; - - for ( var i = 0, l = root.length; i < l; i++ ) { - Sizzle( selector, root[i], tmpSet, seed ); - } - - return Sizzle.filter( later, tmpSet ); -}; - -// EXPOSE -// Override sizzle attribute retrieval -Sizzle.attr = jQuery.attr; -Sizzle.selectors.attrMap = {}; -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.filters; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - -})(); - - -var runtil = /Until$/, - rparentsprev = /^(?:parents|prevUntil|prevAll)/, - // Note: This RegExp should be improved, or likely pulled from Sizzle - rmultiselector = /,/, - isSimple = /^.[^:#\[\.,]*$/, - slice = Array.prototype.slice, - POS = jQuery.expr.match.POS, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend({ - find: function( selector ) { - var self = this, - i, l; - - if ( typeof selector !== "string" ) { - return jQuery( selector ).filter(function() { - for ( i = 0, l = self.length; i < l; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }); - } - - var ret = this.pushStack( "", "find", selector ), - length, n, r; - - for ( i = 0, l = this.length; i < l; i++ ) { - length = ret.length; - jQuery.find( selector, this[i], ret ); - - if ( i > 0 ) { - // Make sure that the results are unique - for ( n = length; n < ret.length; n++ ) { - for ( r = 0; r < length; r++ ) { - if ( ret[r] === ret[n] ) { - ret.splice(n--, 1); - break; - } - } - } - } - } - - return ret; - }, - - has: function( target ) { - var targets = jQuery( target ); - return this.filter(function() { - for ( var i = 0, l = targets.length; i < l; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector, false), "not", selector); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector, true), "filter", selector ); - }, - - is: function( selector ) { - return !!selector && ( - typeof selector === "string" ? - // If this is a positional selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - POS.test( selector ) ? - jQuery( selector, this.context ).index( this[0] ) >= 0 : - jQuery.filter( selector, this ).length > 0 : - this.filter( selector ).length > 0 ); - }, - - closest: function( selectors, context ) { - var ret = [], i, l, cur = this[0]; - - // Array (deprecated as of jQuery 1.7) - if ( jQuery.isArray( selectors ) ) { - var level = 1; - - while ( cur && cur.ownerDocument && cur !== context ) { - for ( i = 0; i < selectors.length; i++ ) { - - if ( jQuery( cur ).is( selectors[ i ] ) ) { - ret.push({ selector: selectors[ i ], elem: cur, level: level }); - } - } - - cur = cur.parentNode; - level++; - } - - return ret; - } - - // String - var pos = POS.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( i = 0, l = this.length; i < l; i++ ) { - cur = this[i]; - - while ( cur ) { - if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { - ret.push( cur ); - break; - - } else { - cur = cur.parentNode; - if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { - break; - } - } - } - } - - ret = ret.length > 1 ? jQuery.unique( ret ) : ret; - - return this.pushStack( ret, "closest", selectors ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } - - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? - all : - jQuery.unique( all ) ); - }, - - andSelf: function() { - return this.add( this.prevObject ); - } -}); - -// A painfully simple check to see if an element is disconnected -// from a document (should be improved, where feasible). -function isDisconnected( node ) { - return !node || !node.parentNode || node.parentNode.nodeType === 11; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return jQuery.nth( elem, 2, "nextSibling" ); - }, - prev: function( elem ) { - return jQuery.nth( elem, 2, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( elem.parentNode.firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.makeArray( elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( !runtil.test( name ) ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; - - if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - - return this.pushStack( ret, name, slice.call( arguments ).join(",") ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 ? - jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : - jQuery.find.matches(expr, elems); - }, - - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - nth: function( cur, result, dir, elem ) { - result = result || 1; - var num = 0; - - for ( ; cur; cur = cur[dir] ) { - if ( cur.nodeType === 1 && ++num === result ) { - break; - } - } - - return cur; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, keep ) { - - // Can't pass null or undefined to indexOf in Firefox 4 - // Set to 0 to skip string check - qualifier = qualifier || 0; - - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - var retVal = !!qualifier.call( elem, i, elem ); - return retVal === keep; - }); - - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem, i ) { - return ( elem === qualifier ) === keep; - }); - - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); - - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } - - return jQuery.grep(elements, function( elem, i ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; - }); -} - - - - -function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); - - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); - } - } - return safeFrag; -} - -var nodeNames = "abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, - rtagName = /<([\w:]+)/, - rtbody = /", "" ], - legend: [ 1, "
", "
" ], - thead: [ 1, "", "
" ], - tr: [ 2, "", "
" ], - td: [ 3, "", "
" ], - col: [ 2, "", "
" ], - area: [ 1, "", "" ], - _default: [ 0, "", "" ] - }, - safeFragment = createSafeFragment( document ); - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// IE can't serialize and