From cdd7a8350d5ad23c49c916399dfaace2cd4ab99a Mon Sep 17 00:00:00 2001 From: Arfrever Frehtes Taifersar Arahesis Date: Mon, 21 Sep 2009 17:41:45 +0000 Subject: [PATCH] Define long as int when Python 3 is used. svn path=/main/trunk/; revision=14343 --- bin/egencache | 3 +++ pym/_emerge/BinpkgFetcher.py | 3 +++ pym/_emerge/BlockerCache.py | 1 + pym/_emerge/BlockerDB.py | 5 +++++ pym/_emerge/FakeVartree.py | 5 +++++ pym/_emerge/Package.py | 1 + pym/_emerge/actions.py | 3 +++ pym/_emerge/depgraph.py | 1 + pym/_emerge/main.py | 3 +++ pym/portage/__init__.py | 1 + pym/portage/cache/flat_hash.py | 4 ++++ pym/portage/cache/flat_list.py | 4 ++++ pym/portage/cache/fs_template.py | 4 ++++ pym/portage/cache/metadata.py | 1 + pym/portage/cache/template.py | 1 + pym/portage/cvstree.py | 4 ++++ pym/portage/dbapi/bintree.py | 1 + pym/portage/dbapi/porttree.py | 4 ++++ pym/portage/dbapi/vartree.py | 1 + pym/portage/eclass_cache.py | 4 ++++ pym/portage/getbinpkg.py | 3 +++ pym/portage/update.py | 3 +++ 22 files changed, 60 insertions(+) diff --git a/bin/egencache b/bin/egencache index 5c59e6dd0..b160189a3 100755 --- a/bin/egencache +++ b/bin/egencache @@ -38,6 +38,9 @@ from portage.util import writemsg_level from portage import cpv_getkey from portage.dep import isjustname +if sys.hexversion >= 0x3000000: + long = int + def parse_args(args): usage = "egencache [options] --update [atom] ..." parser = optparse.OptionParser(usage=usage) diff --git a/pym/_emerge/BinpkgFetcher.py b/pym/_emerge/BinpkgFetcher.py index 576d00a60..fbf34df72 100644 --- a/pym/_emerge/BinpkgFetcher.py +++ b/pym/_emerge/BinpkgFetcher.py @@ -11,6 +11,9 @@ import sys import portage from portage import os +if sys.hexversion >= 0x3000000: + long = int + class BinpkgFetcher(SpawnProcess): __slots__ = ("pkg", "pretend", diff --git a/pym/_emerge/BlockerCache.py b/pym/_emerge/BlockerCache.py index 7c6be8ada..f88a7c43f 100644 --- a/pym/_emerge/BlockerCache.py +++ b/pym/_emerge/BlockerCache.py @@ -15,6 +15,7 @@ except ImportError: if sys.hexversion >= 0x3000000: basestring = str + long = int class BlockerCache(portage.cache.mappings.MutableMapping): """This caches blockers of installed packages so that dep_check does not diff --git a/pym/_emerge/BlockerDB.py b/pym/_emerge/BlockerDB.py index 436793c59..1c4af1cae 100644 --- a/pym/_emerge/BlockerDB.py +++ b/pym/_emerge/BlockerDB.py @@ -2,6 +2,8 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ +import sys + import portage from portage import os from portage import digraph @@ -11,6 +13,9 @@ from _emerge.BlockerCache import BlockerCache from _emerge.FakeVartree import FakeVartree from _emerge.show_invalid_depstring_notice import show_invalid_depstring_notice +if sys.hexversion >= 0x3000000: + long = int + class BlockerDB(object): def __init__(self, root_config): diff --git a/pym/_emerge/FakeVartree.py b/pym/_emerge/FakeVartree.py index 98d08891c..96d13bd28 100644 --- a/pym/_emerge/FakeVartree.py +++ b/pym/_emerge/FakeVartree.py @@ -2,11 +2,16 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ +import sys + import portage from portage import os from _emerge.Package import Package from _emerge.PackageVirtualDbapi import PackageVirtualDbapi +if sys.hexversion >= 0x3000000: + long = int + class FakeVartree(portage.vartree): """This is implements an in-memory copy of a vartree instance that provides all the interfaces required for use by the depgraph. The vardb is locked diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py index 15471d1b2..ad15dc646 100644 --- a/pym/_emerge/Package.py +++ b/pym/_emerge/Package.py @@ -12,6 +12,7 @@ from _emerge.Task import Task if sys.hexversion >= 0x3000000: basestring = str + long = int class Package(Task): diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index 0bdda1fc5..4cae98f29 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -55,6 +55,9 @@ from _emerge.UnmergeDepPriority import UnmergeDepPriority from _emerge.UseFlagDisplay import UseFlagDisplay from _emerge.userquery import userquery +if sys.hexversion >= 0x3000000: + long = int + def action_build(settings, trees, mtimedb, myopts, myaction, myfiles, spinner): diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index ed2e88af4..d20016c90 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -53,6 +53,7 @@ from _emerge.visible import visible if sys.hexversion >= 0x3000000: basestring = str + long = int class _frozen_depgraph_config(object): diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py index 09522375f..777d10192 100644 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@ -44,6 +44,9 @@ from _emerge._flush_elog_mod_echo import _flush_elog_mod_echo from _emerge.is_valid_package_atom import is_valid_package_atom from _emerge.stdout_spinner import stdout_spinner +if sys.hexversion >= 0x3000000: + long = int + options=[ "--ask", "--alphabetical", "--buildpkg", "--buildpkgonly", diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 043486542..e2fd1fbaa 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -125,6 +125,7 @@ except ImportError as e: if sys.hexversion >= 0x3000000: basestring = str + long = int # Assume utf_8 fs encoding everywhere except in merge code, where the # user's locale is respected. diff --git a/pym/portage/cache/flat_hash.py b/pym/portage/cache/flat_hash.py index 3f46df8b9..918c935f5 100644 --- a/pym/portage/cache/flat_hash.py +++ b/pym/portage/cache/flat_hash.py @@ -8,10 +8,14 @@ from portage.cache import fs_template from portage.cache import cache_errors import errno import stat +import sys from portage import os from portage import _encodings from portage import _unicode_encode +if sys.hexversion >= 0x3000000: + long = int + class database(fs_template.FsBased): autocommits = True diff --git a/pym/portage/cache/flat_list.py b/pym/portage/cache/flat_list.py index cfa3340cd..c7d618c26 100644 --- a/pym/portage/cache/flat_list.py +++ b/pym/portage/cache/flat_list.py @@ -6,6 +6,10 @@ from portage import _unicode_encode import codecs import errno import stat +import sys + +if sys.hexversion >= 0x3000000: + long = int # store the current key order *here*. class database(fs_template.FsBased): diff --git a/pym/portage/cache/fs_template.py b/pym/portage/cache/fs_template.py index 97be3ab77..7cd8af4d7 100644 --- a/pym/portage/cache/fs_template.py +++ b/pym/portage/cache/fs_template.py @@ -3,6 +3,7 @@ # License: GPL2 # $Id$ +import sys from portage.cache import template from portage import os @@ -14,6 +15,9 @@ lazyimport(globals(), ) del lazyimport +if sys.hexversion >= 0x3000000: + long = int + class FsBased(template.database): """template wrapping fs needed options, and providing _ensure_access as a way to attempt to ensure files have the specified owners/perms""" diff --git a/pym/portage/cache/metadata.py b/pym/portage/cache/metadata.py index 8518c0e69..3f8ff1149 100644 --- a/pym/portage/cache/metadata.py +++ b/pym/portage/cache/metadata.py @@ -16,6 +16,7 @@ from portage.cache.mappings import ProtectedDict if sys.hexversion >= 0x3000000: basestring = str + long = int # this is the old cache format, flat_list. count maintained here. magic_line_count = 22 diff --git a/pym/portage/cache/template.py b/pym/portage/cache/template.py index e90c9dba5..650f5135d 100644 --- a/pym/portage/cache/template.py +++ b/pym/portage/cache/template.py @@ -11,6 +11,7 @@ import warnings if sys.hexversion >= 0x3000000: basestring = str + long = int class database(object): # this is for metadata/cache transfer. diff --git a/pym/portage/cvstree.py b/pym/portage/cvstree.py index eaf7f37a5..87724adf1 100644 --- a/pym/portage/cvstree.py +++ b/pym/portage/cvstree.py @@ -7,12 +7,16 @@ from __future__ import print_function import codecs import re +import sys import time from portage import os from portage import _encodings from portage import _unicode_encode +if sys.hexversion >= 0x3000000: + long = int + # [D]/Name/Version/Date/Flags/Tags def pathdata(entries, path): diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index ff277a8fa..818dba9cf 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -34,6 +34,7 @@ from itertools import chain if sys.hexversion >= 0x3000000: basestring = str + long = int class bindbapi(fakedbapi): _known_keys = frozenset(list(fakedbapi._known_keys) + \ diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index bf97af63e..f0950ce95 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -35,8 +35,12 @@ from portage import _unicode_encode import codecs import logging import stat +import sys import warnings +if sys.hexversion >= 0x3000000: + long = int + def _src_uri_validate(cpv, eapi, src_uri): """ Take a SRC_URI structure as returned by paren_reduce or use_reduce diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 635ba6026..12dd15f1b 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -60,6 +60,7 @@ except ImportError: if sys.hexversion >= 0x3000000: basestring = str + long = int class PreservedLibsRegistry(object): """ This class handles the tracking of preserved library objects """ diff --git a/pym/portage/eclass_cache.py b/pym/portage/eclass_cache.py index 2c3c66c86..26019400b 100644 --- a/pym/portage/eclass_cache.py +++ b/pym/portage/eclass_cache.py @@ -5,12 +5,16 @@ __all__ = ["cache"] +import sys import warnings from portage.util import normalize_path import errno from portage.exception import PermissionDenied from portage import os +if sys.hexversion >= 0x3000000: + long = int + class cache(object): """ Maintains the cache information about eclasses used in ebuild. diff --git a/pym/portage/getbinpkg.py b/pym/portage/getbinpkg.py index 35bef052a..95bd1dbc6 100644 --- a/pym/portage/getbinpkg.py +++ b/pym/portage/getbinpkg.py @@ -51,6 +51,9 @@ try: except ImportError as e: sys.stderr.write(colorize("BAD","!!! CANNOT IMPORT HTTP.CLIENT: ")+str(e)+"\n") +if sys.hexversion >= 0x3000000: + long = int + def make_metadata_dict(data): myid,myglob = data diff --git a/pym/portage/update.py b/pym/portage/update.py index 1ea15e7e9..5e6937d44 100644 --- a/pym/portage/update.py +++ b/pym/portage/update.py @@ -24,6 +24,9 @@ from portage.const import USER_CONFIG_PATH from portage.exception import DirectoryNotFound, InvalidAtom, PortageException from portage.localization import _ +if sys.hexversion >= 0x3000000: + long = int + ignored_dbentries = ("CONTENTS", "environment.bz2") def update_dbentry(update_cmd, mycontent): -- 2.26.2