diff options
| -rw-r--r-- | apt/cache.py | 9 | ||||
| -rw-r--r-- | apt/package.py | 9 | ||||
| -rw-r--r-- | data/templates/Ubuntu.info.in | 61 | ||||
| -rw-r--r-- | debian/changelog | 41 | ||||
| -rw-r--r-- | doc/source/library/apt_pkg.rst | 45 | ||||
| -rw-r--r-- | po/zh_CN.po | 371 | ||||
| -rw-r--r-- | python/apt_pkgmodule.cc | 20 | ||||
| -rw-r--r-- | python/cache.cc | 37 | ||||
| -rw-r--r-- | python/progress.cc | 9 | ||||
| -rw-r--r-- | tests/old/test_enhances.py | 17 |
10 files changed, 307 insertions, 312 deletions
diff --git a/apt/cache.py b/apt/cache.py index bda08a24..fdd50fa6 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -46,7 +46,14 @@ class Cache(object): """Dictionary-like package cache. This class has all the packages that are available in it's - dictionary + dictionary. + + Keyword arguments: + progress -- a OpProgress object + rootdir -- a alternative root directory. if that is given + the system sources.list and system lists/ files are + not read, only files relative to the given rootdir + memonly -- build the cache in memory only """ def __init__(self, progress=None, rootdir=None, memonly=False): diff --git a/apt/package.py b/apt/package.py index a811dfbb..315a7589 100644 --- a/apt/package.py +++ b/apt/package.py @@ -398,6 +398,11 @@ class Version(object): return depends_list @property + def enhances(self): + """Return the list of enhances for the package version.""" + return self.get_dependencies("Enhances") + + @property def dependencies(self): """Return the dependencies of the package version.""" return self.get_dependencies("PreDepends", "Depends") @@ -591,7 +596,7 @@ class VersionList(Sequence): except TypeError: # Dictionary interface item is a string. for ver in self._versions: - if ver.ver_str == item: + if ver.VerStr == item: return Version(self._package, ver) raise KeyError("Version: %r not found." % (item)) @@ -607,7 +612,7 @@ class VersionList(Sequence): item = item.version # Dictionary interface. for ver in self._versions: - if ver.ver_str == item: + if ver.VerStr == item: return True return False diff --git a/data/templates/Ubuntu.info.in b/data/templates/Ubuntu.info.in index a8993d8a..2335454f 100644 --- a/data/templates/Ubuntu.info.in +++ b/data/templates/Ubuntu.info.in @@ -1,5 +1,66 @@ _ChangelogURI: http://changelogs.ubuntu.com/changelogs/pool/%s/%s/%s/%s_%s/changelog +Suite: lucid +RepositoryType: deb +BaseURI: http://archive.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu +BaseURI-powerpc: http://ports.ubuntu.com/ +MatchURI-powerpc: ports.ubuntu.com|archive.ubuntu.com +BaseURI-lpia: http://ports.ubuntu.com/ +MatchURI-lpia: ports.ubuntu.com|archive.ubuntu.com +MirrorsFile-amd64: /usr/share/python-apt/templates/Ubuntu.mirrors +MirrorsFile-i386: /usr/share/python-apt/templates/Ubuntu.mirrors +_Description: Ubuntu 10.04 'Lucid Lynx' +Component: main +_CompDescription: Officially supported +_CompDescriptionLong: Canonical-supported Open Source software +Component: universe +_CompDescription: Community-maintained +_CompDescriptionLong: Community-maintained Open Source software +Component: restricted +_CompDescription: Non-free drivers +_CompDescriptionLong: Proprietary drivers for devices +Component: multiverse +_CompDescription: Restricted software +_CompDescriptionLong: Software restricted by copyright or legal issues + +Suite: lucid +MatchName: .* +BaseURI: cdrom:\[Ubuntu.*10.04 +MatchURI: cdrom:\[Ubuntu.*10.04 +_Description: Cdrom with Ubuntu 10.04 'Lucid Lynx' +Available: False +Component: main +_CompDescription: Officially supported +Component: restricted +_CompDescription: Restricted copyright + +Suite: lucid-security +ParentSuite: lucid +RepositoryType: deb +BaseURI: http://security.ubuntu.com/ubuntu/ +MatchURI: archive.ubuntu.com/ubuntu|security.ubuntu.com +BaseURI-powerpc: http://ports.ubuntu.com/ +MatchURI-powerpc: ports.ubuntu.com/ubuntu +BaseURI-lpia: http://ports.ubuntu.com/ +MatchURI-lpia: ports.ubuntu.com/ubuntu +_Description: Important security updates + +Suite: lucid-updates +ParentSuite: lucid +RepositoryType: deb +_Description: Recommended updates + +Suite: lucid-proposed +ParentSuite: lucid +RepositoryType: deb +_Description: Pre-released updates + +Suite: lucid-backports +ParentSuite: lucid +RepositoryType: deb +_Description: Unsupported updates + Suite: karmic RepositoryType: deb BaseURI: http://archive.ubuntu.com/ubuntu/ diff --git a/debian/changelog b/debian/changelog index fb3b72f9..5f716c04 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,6 @@ python-apt (0.7.93) UNRELEASED; urgency=low - * Merge 0.7.13.0 - 0.7.13.3 from unstable. + * Merge 0.7.13.0 - 0.7.13.5 (UNRELEASED) from unstable. * Add a tutorial on how to do things which are possible with apt-get, like apt-get --print-uris update (cf. #551164). @@ -86,6 +86,45 @@ python-apt (0.7.90) experimental; urgency=low -- Julian Andres Klode <jak@debian.org> Wed, 15 Apr 2009 13:47:42 +0200 +python-apt (0.7.13.5) UNRELEASED; urgency=low + + [ Colin Watson ] + * apt/progress/__init__.py: + - Fix InstallProgress.updateInterface() to cope with read() returning 0 + on non-blocking file descriptors (LP: #491027). + + [ Michael Vogt ] + * apt/cache.py: + - improved docstring for the cache + - add "enhances" property + * data/templates/Ubuntu.info.in: + - add lucid + * python/cache.cc: + - add UntranslatedDepType attribute to DependencyType + - add DepTypeEnum that returns a value from + {DepDepends, DepPreDepends, ...} + * python/apt_pkgmodule.cc: + - add DepDpkgBreaks, DepEnhances constants + * doc/source/apt_pkg/{cache.rst, index.rst}: + - update documentation as well + + -- Michael Vogt <michael.vogt@ubuntu.com> Wed, 02 Dec 2009 16:50:55 +0100 + +python-apt (0.7.13.4) unstable; urgency=low + + [ Michael Vogt ] + * po/zh_CN.po: + - updated, thanks to Feng Chao + * python/progress.cc: + - if the mediaChange() does not return anything or is not implemented + send "false" to libapt + + [ Julian Andres Klode ] + * apt/package.py: Fix dictionary access of VersionList, patch + by Sebastian Heinlein (Closes: #554895). + + -- Julian Andres Klode <jak@debian.org> Sun, 29 Nov 2009 20:26:31 +0100 + python-apt (0.7.13.3) unstable; urgency=low [ Michael Vogt ] diff --git a/doc/source/library/apt_pkg.rst b/doc/source/library/apt_pkg.rst index 720b61a3..5876fb8d 100644 --- a/doc/source/library/apt_pkg.rst +++ b/doc/source/library/apt_pkg.rst @@ -638,10 +638,55 @@ Example: The type of the dependency, as string, eg. "Depends". + .. attribute:: dep_type_enum + + The type of the dependency, as an integer which can be compared to + one of the TYPE_* constants below. + + .. attribute:: dep_type_untranslated + + The type of the depndency, as an untranslated string. + .. attribute:: id The ID of the package, as integer. + .. attribute:: TYPE_CONFLICTS + + Constant for checking against dep_type_enum + + .. attribute:: TYPE_DEPENDS + + Constant for checking against dep_type_enum + + .. attribute:: TYPE_DPKG_BREAKS + + Constant for checking against dep_type_enum + + .. attribute:: TYPE_ENHANCES + + Constant for checking against dep_type_enum + + .. attribute:: TYPE_OBSOLETES + + Constant for checking against dep_type_enum + + .. attribute:: TYPE_PREDEPENDS + + Constant for checking against dep_type_enum + + .. attribute:: TYPE_RECOMMENDS + + Constant for checking against dep_type_enum + + .. attribute:: TYPE_REPLACES + + Constant for checking against dep_type_enum + + .. attribute:: TYPE_SUGGESTS + + Constant for checking against dep_type_enum + Example: Find all missing dependencies ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ With the help of Dependency.AllTargets(), you can easily find all packages with diff --git a/po/zh_CN.po b/po/zh_CN.po index fd2099cb..f7bb9fec 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -7,9 +7,9 @@ msgid "" msgstr "" "Project-Id-Version: update-manager HEAD\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-07-19 15:59+0200\n" -"PO-Revision-Date: 2006-10-16 04:00+0000\n" -"Last-Translator: catinsnow <catinsnow@gmail.com>\n" +"POT-Creation-Date: 2009-09-04 09:06+0000\n" +"PO-Revision-Date: 2009-09-06 03:14+0000\n" +"Last-Translator: Feng Chao <rainofchaos@gmail.com>\n" "Language-Team: zh_CN <i18n-translation@lists.linux.net.cn>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -23,125 +23,79 @@ msgid "http://changelogs.ubuntu.com/changelogs/pool/%s/%s/%s/%s_%s/changelog" msgstr "http://changelogs.ubuntu.com/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description -#: ../data/templates/Ubuntu.info.in:13 -#, fuzzy -msgid "Ubuntu 9.10 'Karmic Koala'" -msgstr "Ubuntu 4.10 'Warty Warthog'" - -#. Description -#: ../data/templates/Ubuntu.info.in:31 -#, fuzzy -msgid "Cdrom with Ubuntu 9.10 'Karmic Koala'" -msgstr "Ubuntu 4.10 'Warty Warthog'光盘" - -#. Description -#: ../data/templates/Ubuntu.info.in:74 -#, fuzzy -msgid "Ubuntu 9.04 'Jaunty Jackalope'" -msgstr "Ubuntu 4.10 'Warty Warthog'" - -#. Description -#: ../data/templates/Ubuntu.info.in:92 -#, fuzzy -msgid "Cdrom with Ubuntu 9.04 'Jaunty Jackalope'" -msgstr "Ubuntu 4.10 'Warty Warthog'光盘" - -#. Description -#: ../data/templates/Ubuntu.info.in:135 -#, fuzzy -msgid "Ubuntu 8.10 'Intrepid Ibex'" -msgstr "Ubuntu 5.04 'Hoary Hedgehog'" - -#. Description -#: ../data/templates/Ubuntu.info.in:153 -#, fuzzy -msgid "Cdrom with Ubuntu 8.10 'Intrepid Ibex'" -msgstr "Ubuntu 5.04 'Hoary Hedgehog'光盘" - -#. Description -#: ../data/templates/Ubuntu.info.in:197 -#, fuzzy +#: ../data/templates/Ubuntu.info.in:8 msgid "Ubuntu 8.04 'Hardy Heron'" -msgstr "Ubuntu 5.04 'Hoary Hedgehog'" +msgstr "Ubuntu 8.04‘Hardy Heron’" #. Description -#: ../data/templates/Ubuntu.info.in:215 -#, fuzzy +#: ../data/templates/Ubuntu.info.in:25 msgid "Cdrom with Ubuntu 8.04 'Hardy Heron'" -msgstr "Ubuntu 5.04 'Hoary Hedgehog'光盘" +msgstr "已插入 Ubuntu 8.04 'Hardy Heron' 光盘的光驱" #. Description -#: ../data/templates/Ubuntu.info.in:252 -#, fuzzy +#: ../data/templates/Ubuntu.info.in:60 msgid "Ubuntu 7.10 'Gutsy Gibbon'" -msgstr "Ubuntu 5.04 安全更新" +msgstr "Ubuntu 7.10‘Gutsy Gibbon’" #. Description -#: ../data/templates/Ubuntu.info.in:270 -#, fuzzy +#: ../data/templates/Ubuntu.info.in:77 msgid "Cdrom with Ubuntu 7.10 'Gutsy Gibbon'" -msgstr "Ubuntu 5.10 'Breezy Badger' 光盘" +msgstr "Ubuntu 7.10‘Gutsy Gibbon’光盘" #. Description -#: ../data/templates/Ubuntu.info.in:305 -#, fuzzy +#: ../data/templates/Ubuntu.info.in:112 msgid "Ubuntu 7.04 'Feisty Fawn'" -msgstr "Ubuntu 5.04 安全更新" +msgstr "Ubuntu 7.04‘(Feisty Fawn)’" #. Description -#: ../data/templates/Ubuntu.info.in:323 -#, fuzzy +#: ../data/templates/Ubuntu.info.in:129 msgid "Cdrom with Ubuntu 7.04 'Feisty Fawn'" -msgstr "Ubuntu 5.10 'Breezy Badger' 光盘" +msgstr "已插入 Ubuntu 7.04 'Feisty Fawn' 光盘的光驱" #. Description -#: ../data/templates/Ubuntu.info.in:357 +#: ../data/templates/Ubuntu.info.in:163 msgid "Ubuntu 6.10 'Edgy Eft'" msgstr "Ubuntu 6.10 'Edgy Eft'" #. CompDescription -#: ../data/templates/Ubuntu.info.in:362 -#, fuzzy +#: ../data/templates/Ubuntu.info.in:168 msgid "Community-maintained" -msgstr "社区维护(Universe)" +msgstr "社区维护" #. CompDescription -#: ../data/templates/Ubuntu.info.in:368 +#: ../data/templates/Ubuntu.info.in:174 msgid "Restricted software" msgstr "受限软件" #. Description -#: ../data/templates/Ubuntu.info.in:375 +#: ../data/templates/Ubuntu.info.in:180 msgid "Cdrom with Ubuntu 6.10 'Edgy Eft'" msgstr "Ubuntu 6.10 'Edgy Eft' 光盘" #. Description -#: ../data/templates/Ubuntu.info.in:409 +#: ../data/templates/Ubuntu.info.in:214 msgid "Ubuntu 6.06 LTS 'Dapper Drake'" msgstr "Ubuntu 6.06 LTS 'Dapper Drake'" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:412 -#, fuzzy +#: ../data/templates/Ubuntu.info.in:217 msgid "Canonical-supported Open Source software" -msgstr "社区维护(Universe)" +msgstr "Canonical 支持的开源软件" #. CompDescription -#: ../data/templates/Ubuntu.info.in:414 -#, fuzzy +#: ../data/templates/Ubuntu.info.in:219 msgid "Community-maintained (universe)" -msgstr "社区维护(universe)" +msgstr "社区维护 (universe)" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:415 -#, fuzzy +#: ../data/templates/Ubuntu.info.in:220 msgid "Community-maintained Open Source software" -msgstr "社区维护开源软件" +msgstr "社区维护的开源软件" #. CompDescription -#: ../data/templates/Ubuntu.info.in:417 +#: ../data/templates/Ubuntu.info.in:222 msgid "Non-free drivers" -msgstr "非自由驱动" +msgstr "非开源或私有驱动" #. CompDescriptionLong #: ../data/templates/Ubuntu.info.in:418 @@ -149,141 +103,137 @@ msgid "Proprietary drivers for devices" msgstr "设备的专有驱动" #. CompDescription -#: ../data/templates/Ubuntu.info.in:420 +#: ../data/templates/Ubuntu.info.in:225 msgid "Restricted software (Multiverse)" msgstr "受限软件(Multiverse)" #. CompDescriptionLong -#: ../data/templates/Ubuntu.info.in:421 +#: ../data/templates/Ubuntu.info.in:226 msgid "Software restricted by copyright or legal issues" -msgstr "" +msgstr "有版权和合法性问题的的软件" #. Description -#: ../data/templates/Ubuntu.info.in:427 +#: ../data/templates/Ubuntu.info.in:231 msgid "Cdrom with Ubuntu 6.06 LTS 'Dapper Drake'" msgstr "Ubuntu 6.06 LTS 'Dapper Drake' 光盘" #. Description -#: ../data/templates/Ubuntu.info.in:439 +#: ../data/templates/Ubuntu.info.in:243 msgid "Important security updates" msgstr "重要安全更新" #. Description -#: ../data/templates/Ubuntu.info.in:444 +#: ../data/templates/Ubuntu.info.in:248 msgid "Recommended updates" -msgstr "建议更新" +msgstr "推荐更新" #. Description -#: ../data/templates/Ubuntu.info.in:449 -#, fuzzy +#: ../data/templates/Ubuntu.info.in:253 msgid "Pre-released updates" -msgstr "建议更新" +msgstr "提前释放出的更新" #. Description -#: ../data/templates/Ubuntu.info.in:454 -#, fuzzy +#: ../data/templates/Ubuntu.info.in:258 msgid "Unsupported updates" -msgstr "Backported 更新" +msgstr "不支持的更新" #. Description -#: ../data/templates/Ubuntu.info.in:461 +#: ../data/templates/Ubuntu.info.in:265 msgid "Ubuntu 5.10 'Breezy Badger'" msgstr "Ubuntu 5.10 'Breezy Badger'" #. Description -#: ../data/templates/Ubuntu.info.in:475 +#: ../data/templates/Ubuntu.info.in:278 msgid "Cdrom with Ubuntu 5.10 'Breezy Badger'" msgstr "Ubuntu 5.10 'Breezy Badger' 光盘" #. Description -#: ../data/templates/Ubuntu.info.in:487 +#: ../data/templates/Ubuntu.info.in:290 msgid "Ubuntu 5.10 Security Updates" msgstr "Ubuntu 5.10 安全更新" #. Description -#: ../data/templates/Ubuntu.info.in:492 +#: ../data/templates/Ubuntu.info.in:295 msgid "Ubuntu 5.10 Updates" msgstr "Ubuntu 5.10 更新" #. Description -#: ../data/templates/Ubuntu.info.in:497 +#: ../data/templates/Ubuntu.info.in:300 msgid "Ubuntu 5.10 Backports" msgstr "Ubuntu 5.10 移植" #. Description -#: ../data/templates/Ubuntu.info.in:504 +#: ../data/templates/Ubuntu.info.in:307 msgid "Ubuntu 5.04 'Hoary Hedgehog'" msgstr "Ubuntu 5.04 'Hoary Hedgehog'" #. Description -#: ../data/templates/Ubuntu.info.in:518 +#: ../data/templates/Ubuntu.info.in:320 msgid "Cdrom with Ubuntu 5.04 'Hoary Hedgehog'" msgstr "Ubuntu 5.04 'Hoary Hedgehog'光盘" #. CompDescription -#: ../data/templates/Ubuntu.info.in:521 ../data/templates/Debian.info.in:148 +#: ../data/templates/Ubuntu.info.in:323 ../data/templates/Debian.info.in:94 msgid "Officially supported" msgstr "官方支持" #. Description -#: ../data/templates/Ubuntu.info.in:530 +#: ../data/templates/Ubuntu.info.in:332 msgid "Ubuntu 5.04 Security Updates" msgstr "Ubuntu 5.04 安全更新" #. Description -#: ../data/templates/Ubuntu.info.in:535 -#, fuzzy +#: ../data/templates/Ubuntu.info.in:337 msgid "Ubuntu 5.04 Updates" msgstr "Ubuntu 5.10 更新" #. Description -#: ../data/templates/Ubuntu.info.in:540 +#: ../data/templates/Ubuntu.info.in:342 msgid "Ubuntu 5.04 Backports" msgstr "Ubuntu 5.04 Backports" #. Description -#: ../data/templates/Ubuntu.info.in:546 +#: ../data/templates/Ubuntu.info.in:348 msgid "Ubuntu 4.10 'Warty Warthog'" msgstr "Ubuntu 4.10 'Warty Warthog'" #. CompDescription -#: ../data/templates/Ubuntu.info.in:552 -#, fuzzy +#: ../data/templates/Ubuntu.info.in:354 msgid "Community-maintained (Universe)" -msgstr "社区维护" +msgstr "社区维护 (Universe)" #. CompDescription -#: ../data/templates/Ubuntu.info.in:554 +#: ../data/templates/Ubuntu.info.in:356 msgid "Non-free (Multiverse)" msgstr "非自由" #. Description -#: ../data/templates/Ubuntu.info.in:560 +#: ../data/templates/Ubuntu.info.in:361 msgid "Cdrom with Ubuntu 4.10 'Warty Warthog'" msgstr "Ubuntu 4.10 'Warty Warthog'光盘" #. CompDescription -#: ../data/templates/Ubuntu.info.in:563 +#: ../data/templates/Ubuntu.info.in:364 msgid "No longer officially supported" msgstr "官方不再支持" #. CompDescription -#: ../data/templates/Ubuntu.info.in:565 +#: ../data/templates/Ubuntu.info.in:366 msgid "Restricted copyright" -msgstr "版权限制" +msgstr "版权受限" #. Description -#: ../data/templates/Ubuntu.info.in:572 +#: ../data/templates/Ubuntu.info.in:373 msgid "Ubuntu 4.10 Security Updates" msgstr "Ubuntu 4.10 安全更新" #. Description -#: ../data/templates/Ubuntu.info.in:577 +#: ../data/templates/Ubuntu.info.in:378 msgid "Ubuntu 4.10 Updates" msgstr "Ubuntu 4.10 更新" #. Description -#: ../data/templates/Ubuntu.info.in:582 +#: ../data/templates/Ubuntu.info.in:383 msgid "Ubuntu 4.10 Backports" msgstr "Ubuntu 4.10 Backports" @@ -295,68 +245,53 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 -#, fuzzy -msgid "Debian 6.0 'Squeeze' " -msgstr "Debian 3.1 \"Sarge\"" - -#. Description -#: ../data/templates/Debian.info.in:33 -#, fuzzy -msgid "Debian 5.0 'Lenny' " -msgstr "Debian 3.1 \"Sarge\"" - -#. Description -#: ../data/templates/Debian.info.in:58 -#, fuzzy -msgid "Debian 4.0 'Etch'" -msgstr "Debian 3.1 \"Sarge\"" +msgid "Debian 4.0 'Etch' " +msgstr "" #. Description -#: ../data/templates/Debian.info.in:83 +#: ../data/templates/Debian.info.in:31 #, fuzzy msgid "Debian 3.1 'Sarge'" msgstr "Debian 3.1 \"Sarge\"" #. Description -#: ../data/templates/Debian.info.in:94 +#: ../data/templates/Debian.info.in:42 msgid "Proposed updates" msgstr "建议更新" #. Description -#: ../data/templates/Debian.info.in:101 -#, fuzzy +#: ../data/templates/Debian.info.in:47 msgid "Security updates" -msgstr "重要安全更新" +msgstr "安全更新" #. Description -#: ../data/templates/Debian.info.in:108 +#: ../data/templates/Debian.info.in:54 msgid "Debian current stable release" -msgstr "" +msgstr "当前稳定的 Debian 发布" #. Description -#: ../data/templates/Debian.info.in:121 -#, fuzzy +#: ../data/templates/Debian.info.in:67 msgid "Debian testing" -msgstr "Debian \"Etch\" (测试)" +msgstr "Debian testing" #. Description -#: ../data/templates/Debian.info.in:146 +#: ../data/templates/Debian.info.in:92 #, fuzzy msgid "Debian 'Sid' (unstable)" msgstr "Debian \"Sid\" (非稳定)" #. CompDescription -#: ../data/templates/Debian.info.in:150 +#: ../data/templates/Debian.info.in:96 msgid "DFSG-compatible Software with Non-Free Dependencies" msgstr "带有非自由依赖关系的DFSG兼容软件" #. CompDescription -#: ../data/templates/Debian.info.in:152 +#: ../data/templates/Debian.info.in:98 msgid "Non-DFSG-compatible Software" msgstr "非DFSG兼容软件" #. TRANSLATORS: %s is a country -#: ../aptsources/distro.py:208 ../aptsources/distro.py:423 +#: ../aptsources/distro.py:194 ../aptsources/distro.py:401 #, python-format msgid "Server for %s" msgstr "%s 的服务器" @@ -364,160 +299,12 @@ msgstr "%s 的服务器" #. More than one server is used. Since we don't handle this case #. in the user interface we set "custom servers" to true and #. append a list of all used servers -#: ../aptsources/distro.py:226 ../aptsources/distro.py:232 -#: ../aptsources/distro.py:248 +#: ../aptsources/distro.py:213 ../aptsources/distro.py:218 +#: ../aptsources/distro.py:232 msgid "Main server" msgstr "主服务器" -#: ../aptsources/distro.py:252 +#: ../aptsources/distro.py:235 msgid "Custom servers" msgstr "自定义服务器" -#: ../apt/progress/gtk2.py:259 -#, fuzzy, python-format -msgid "Downloading file %(current)li of %(total)li with %(speed)s/s" -msgstr "正在下载文件 %li/%li 速度是 %s/s" - -#: ../apt/progress/gtk2.py:265 -#, fuzzy, python-format -msgid "Downloading file %(current)li of %(total)li" -msgstr "正在下载文件 %li/%li 速度是 %s/s" - -#. Setup some child widgets -#: ../apt/progress/gtk2.py:285 -msgid "Details" -msgstr "详细信息" - -#: ../apt/progress/gtk2.py:367 -#, fuzzy -msgid "Starting..." -msgstr "设置" - -#: ../apt/progress/gtk2.py:373 -msgid "Complete" -msgstr "" - -#: ../apt/package.py:301 -#, python-format -msgid "Invalid unicode in description for '%s' (%s). Please report." -msgstr "" - -#: ../apt/package.py:937 ../apt/package.py:1043 -msgid "The list of changes is not available" -msgstr "变动列表尚不可用。" - -#: ../apt/package.py:1047 -#, python-format -msgid "" -"The list of changes is not available yet.\n" -"\n" -"Please use http://launchpad.net/ubuntu/+source/%s/%s/+changelog\n" -"until the changes become available or try again later." -msgstr "" - -#: ../apt/package.py:1053 -#, fuzzy -msgid "" -"Failed to download the list of changes. \n" -"Please check your Internet connection." -msgstr "无法下载更新列表。请检查您的网络连接。" - -#: ../apt/debfile.py:56 -#, python-format -msgid "This is not a valid DEB archive, missing '%s' member" -msgstr "" - -#: ../apt/debfile.py:81 -#, python-format -msgid "List of files for '%s'could not be read" -msgstr "" - -#: ../apt/debfile.py:149 -#, python-format -msgid "Dependency is not satisfiable: %s\n" -msgstr "" - -#: ../apt/debfile.py:173 -#, python-format -msgid "Conflicts with the installed package '%s'" -msgstr "" - -#: ../apt/debfile.py:319 -#, python-format -msgid "Wrong architecture '%s'" -msgstr "" - -#. the deb is older than the installed -#: ../apt/debfile.py:325 -msgid "A later version is already installed" -msgstr "" - -#: ../apt/debfile.py:345 -msgid "Failed to satisfy all dependencies (broken cache)" -msgstr "" - -#: ../apt/debfile.py:376 -#, fuzzy, python-format -msgid "Cannot install '%s'" -msgstr "无法安装'%s'" - -#: ../apt/debfile.py:484 -#, python-format -msgid "Install Build-Dependencies for source package '%s' that builds %s\n" -msgstr "" - -#: ../apt/debfile.py:494 -#, fuzzy -msgid "An essential package would be removed" -msgstr "一个必要的软件包会被删除" - -#: ../apt/progress/text.py:81 -#, python-format -msgid "%c%s... Done" -msgstr "" - -#: ../apt/progress/text.py:118 -msgid "Hit " -msgstr "" - -#: ../apt/progress/text.py:126 -msgid "Ign " -msgstr "" - -#: ../apt/progress/text.py:128 -msgid "Err " -msgstr "" - -#: ../apt/progress/text.py:138 -msgid "Get:" -msgstr "" - -#: ../apt/progress/text.py:198 -msgid " [Working]" -msgstr "" - -#: ../apt/progress/text.py:208 -#, python-format -msgid "" -"Media change: please insert the disc labeled\n" -" '%s'\n" -"in the drive '%s' and press enter\n" -msgstr "" - -#. Trick for getting a translation from apt -#: ../apt/progress/text.py:216 -#, python-format -msgid "Fetched %sB in %s (%sB/s)\n" -msgstr "" - -#: ../apt/progress/text.py:229 -msgid "Please provide a name for this Disc, such as 'Debian 2.1r1 Disk 1'" -msgstr "" - -#: ../apt/progress/text.py:241 -msgid "Please insert a Disc in the drive and press enter" -msgstr "" - -#: ../apt/cache.py:96 -msgid "Building data structures" -msgstr "" diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc index faea423f..f20b0c87 100644 --- a/python/apt_pkgmodule.cc +++ b/python/apt_pkgmodule.cc @@ -680,6 +680,26 @@ extern "C" void initapt_pkg() PyDict_SetItemString(PyAcquire_Type.tp_dict, "ResultFailed", Py_BuildValue("i", pkgAcquire::Failed)); #endif + // Dependency constants + PyDict_SetItemString(PyDependency_Type.tp_dict, "TYPE_DEPENDS", + Py_BuildValue("i", pkgCache::Dep::Depends)); + PyDict_SetItemString(PyDependency_Type.tp_dict, "TYPE_PREDEPENDS", + Py_BuildValue("i", pkgCache::Dep::PreDepends)); + PyDict_SetItemString(PyDependency_Type.tp_dict, "TYPE_SUGGESTS", + Py_BuildValue("i", pkgCache::Dep::Suggests)); + PyDict_SetItemString(PyDependency_Type.tp_dict, "TYPE_RECOMMENDS", + Py_BuildValue("i", pkgCache::Dep::Suggests)); + PyDict_SetItemString(PyDependency_Type.tp_dict, "TYPE_CONFLICTS", + Py_BuildValue("i", pkgCache::Dep::Conflicts)); + PyDict_SetItemString(PyDependency_Type.tp_dict, "TYPE_REPLACES", + Py_BuildValue("i", pkgCache::Dep::Replaces)); + PyDict_SetItemString(PyDependency_Type.tp_dict, "TYPE_OBSOLETES", + Py_BuildValue("i", pkgCache::Dep::Obsoletes)); + PyDict_SetItemString(PyDependency_Type.tp_dict, "TYPE_DPKG_BREAKS", + Py_BuildValue("i", pkgCache::Dep::DpkgBreaks)); + PyDict_SetItemString(PyDependency_Type.tp_dict, "TYPE_ENHANCES", + Py_BuildValue("i", pkgCache::Dep::Enhances)); + // PackageManager constants PyDict_SetItemString(PyPackageManager_Type.tp_dict, "result_completed", diff --git a/python/cache.cc b/python/cache.cc index 084f6d8c..6bbf0766 100644 --- a/python/cache.cc +++ b/python/cache.cc @@ -27,6 +27,17 @@ class pkgSourceList; +// must be in sync with pkgCache::DepType in libapt +// it sucks to have it here duplicated, but we get it +// translated from libapt and that is certainly not what +// we want in a programing interface +const char *UntranslatedDepTypes[] = +{ + "", "Depends","PreDepends","Suggests", + "Recommends","Conflicts","Replaces", + "Obsoletes", "Breaks", "Enhances" +}; + /*}}}*/ struct PkgListStruct { @@ -683,17 +694,7 @@ static PyObject *MakeDepends(PyObject *Owner,pkgCache::VerIterator &Ver, // Switch/create a new dict entry if (LastDepType != Start->Type || LastDep != 0) { - // must be in sync with pkgCache::DepType in libapt - // it sucks to have it here duplicated, but we get it - // translated from libapt and that is certainly not what - // we want in a programing interface - const char *Types[] = - { - "", "Depends","PreDepends","Suggests", - "Recommends","Conflicts","Replaces", - "Obsoletes", "Breaks", "Enhances" - }; - PyObject *Dep = PyString_FromString(Types[Start->Type]); + PyObject *Dep = PyString_FromString(UntranslatedDepTypes[Start->Type]); LastDepType = Start->Type; LastDep = PyDict_GetItem(Dict,Dep); if (LastDep == 0) @@ -1194,6 +1195,18 @@ static PyObject *DependencyGetDepType(PyObject *Self,void*) return PyString_FromString(Dep.DepType()); } +static PyObject *DependencyGetDepTypeUntranslated(PyObject *Self,void*) +{ + pkgCache::DepIterator &Dep = GetCpp<pkgCache::DepIterator>(Self); + return PyString_FromString(UntranslatedDepTypes[Dep->Type]); +} + +static PyObject *DependencyGetDepTypeEnum(PyObject *Self,void*) +{ + pkgCache::DepIterator &Dep = GetCpp<pkgCache::DepIterator>(Self); + return Py_BuildValue("i", Dep->Type); +} + static PyObject *DependencyGetID(PyObject *Self,void*) { pkgCache::DepIterator &Dep = GetCpp<pkgCache::DepIterator>(Self); @@ -1203,6 +1216,8 @@ static PyObject *DependencyGetID(PyObject *Self,void*) static PyGetSetDef DependencyGetSet[] = { {"comp_type",DependencyGetCompType}, {"dep_type",DependencyGetDepType}, + {"dep_type_untranslated",DependencyGetDepTypeUntranslated}, + {"dep_type_enum",DependencyGetDepTypeEnum}, {"id",DependencyGetID}, {"parent_pkg",DependencyGetParentPkg}, {"parent_ver",DependencyGetParentVer}, diff --git a/python/progress.cc b/python/progress.cc index c754dd35..30f62763 100644 --- a/python/progress.cc +++ b/python/progress.cc @@ -129,11 +129,10 @@ bool PyFetchProgress::MediaChange(string Media, string Drive) RunSimpleCallback("mediaChange", arglist, &result); bool res = true; - if(!PyArg_Parse(result, "b", &res)) - std::cerr << "result could not be parsed" << std::endl; - - // FIXME: find out what it should return usually - //std::cerr << "res is: " << res << std::endl; + if(!PyArg_Parse(result, "b", &res)) { + // no return value or None, assume false + return false; + } PyCbObj_BEGIN_ALLOW_THREADS return res; diff --git a/tests/old/test_enhances.py b/tests/old/test_enhances.py new file mode 100644 index 00000000..3eced9f9 --- /dev/null +++ b/tests/old/test_enhances.py @@ -0,0 +1,17 @@ +#!/usr/bin/python + +import apt + +cache = apt.Cache() + +for pkg in cache: + if pkg.installed and pkg.installed.enhances: + s = "%s enhances:" % pkg.name + for or_list in pkg.installed.enhances: + for enhances in or_list.or_dependencies: + s += " %s" % enhances.name + if (cache.has_key(enhances.name) and + not cache[enhances.name].isInstalled): + s += "(*missing*) " + s += "," + print s[:-1] |
