From nobody Fri Mar 25 13:50:05 2022 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 18C071A33B61; Fri, 25 Mar 2022 13:50:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KQ3PV4rBVz3R38; Fri, 25 Mar 2022 13:50:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648216206; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WFQmg/8+YSjphrbsPQD+Pj2dE3umGmMuHXOc3u0wOZk=; b=xpQgA2ubTTvIcL0Ga726kbf1aD86JVygNNG8wVAOdmZAWz/zOicbvOWWbTcGPwskRuTGoZ vSE016rVnqJirFmSlM9DWslY/kngG+8/cR202xR+adGD8sHMp1GcP27jV42QZWBgy28GjH IFpbirsf44RL3206ZlMAGeLosrBEhSDEfwixk4HtHZvdNaksh9FliCxoAz9rE/FcsmcuEk lOmCcHn7CEa42hi5bbIs6+Y/rpB4EXrW185Nxkl7jLUGIKp/eZYocIXn1FROMtrnK+DgOa k26sa/RjyxaD+r02PWzyVzsiZgSfCm4Tja8133KKJxJPO74AZuhQ4EpEbqL8gg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2DB5C55C3; Fri, 25 Mar 2022 13:50:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 22PDo599030489; Fri, 25 Mar 2022 13:50:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22PDo57N030486; Fri, 25 Mar 2022 13:50:05 GMT (envelope-from git) Date: Fri, 25 Mar 2022 13:50:05 GMT Message-Id: <202203251350.22PDo57N030486@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Po-Chuan Hsieh Subject: git: c0583368636e - main - devel/py-optik: Fix build with setuptools 58.0.0+ List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: sunpoet X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c0583368636e5fc529eee68bec35838bea0913ea Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648216206; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WFQmg/8+YSjphrbsPQD+Pj2dE3umGmMuHXOc3u0wOZk=; b=RI6V6rKpMPb0P86ZkoxkKWaVpLlpWVUOTpzTMz2CZGCTpg2csuYxU55xkRQdyarx+TpT34 bK1ezr1f0jFGttYmrcEvpLDz5eTfh6aCsu+RaWx8oB6E+VmeWSZ82xtKzcoRfBQvdve0Td 0VWuniD+dIhuwZXqmtnlf4ixokmmWqppw6vQxBX5+g79wQ2wNDJ3F8YXfQIe4jA1VUt1OW IfraGEnIAx+ekgwrZRARIErfXv2nh/yut1OMXkzXmJz10b6AVb9BG2iS5I4+ecfbm0QS7K qub+WBUnckNCMDSlp3UzVFnGr1pdll3rX9bgaZPL8DWkdiJwVCPK3hwrw98W/Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648216206; a=rsa-sha256; cv=none; b=CS4ehfOZgcNAg4SVAPbPu5in09bRlJ9eqCH+w1PKElhMfKK+h5m/dSjSl9urLGNcdMohM9 X+t6U7cHqVnXSFrum+QdGucgz/rBWe7+9E9zC/l/tWtEqwBYkljJJl5fBkgpl4816w8hKX stS51uRy11J+y7wGtajBuqH2D8lJBuMRa/Xtb4StReVd8gGaF9gJ8SSq7PZEqcLTkeNmON YtVG1VHtBFFBGsWtF8uUx/DfWFGe3Ec5++rWYLqRwYZFTOzS5HTo1kO9A0i8vATgLyP0TY rg2PX5UTWyRxye4vBEy1KVY+OE1E6cGMSBw4g9RoW53kN62KFBjMqbEQ/4H1VA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by sunpoet: URL: https://cgit.FreeBSD.org/ports/commit/?id=c0583368636e5fc529eee68bec35838bea0913ea commit c0583368636e5fc529eee68bec35838bea0913ea Author: Po-Chuan Hsieh AuthorDate: 2022-03-25 13:32:19 +0000 Commit: Po-Chuan Hsieh CommitDate: 2022-03-25 13:38:10 +0000 devel/py-optik: Fix build with setuptools 58.0.0+ With hat: python --- devel/py-optik/files/patch-2to3 | 352 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 352 insertions(+) diff --git a/devel/py-optik/files/patch-2to3 b/devel/py-optik/files/patch-2to3 new file mode 100644 index 000000000000..1103787507b8 --- /dev/null +++ b/devel/py-optik/files/patch-2to3 @@ -0,0 +1,352 @@ +--- lib/help.py.orig 2006-07-23 15:21:30 UTC ++++ lib/help.py +@@ -8,7 +8,7 @@ to generate formatted help text. + # See the README.txt distributed with Optik for licensing terms. + + import os +-import textwrap ++from . import textwrap + from optik.option import NO_DEFAULT + from optik.errors import gettext as _ + +@@ -110,10 +110,10 @@ class HelpFormatter: + self.level -= 1 + + def format_usage(self, usage): +- raise NotImplementedError, "subclasses must implement" ++ raise NotImplementedError("subclasses must implement") + + def format_heading(self, heading): +- raise NotImplementedError, "subclasses must implement" ++ raise NotImplementedError("subclasses must implement") + + def _format_text(self, text): + """ +--- lib/option.py.orig 2006-06-11 16:22:02 UTC ++++ lib/option.py +@@ -14,14 +14,8 @@ __revision__ = "$Id: option.py 522 2006-06-11 16:22:03 + + __all__ = ['Option'] + +-# Do the right thing with boolean values for all known Python versions. +-try: +- True, False +-except NameError: +- (True, False) = (1, 0) ++_idmax = 2 * sys.maxsize + 1 + +-_idmax = 2L * sys.maxint + 1 +- + def _repr(self): + return "<%s at 0x%x: %s>" % (self.__class__.__name__, + id(self) & _idmax, +@@ -44,7 +38,7 @@ def _parse_int(val): + return _parse_num(val, int) + + def _parse_long(val): +- return _parse_num(val, long) ++ return _parse_num(val, int) + + _builtin_cvt = { "int" : (_parse_int, _("integer")), + "long" : (_parse_long, _("long integer")), +@@ -211,7 +205,7 @@ class Option: + # Filter out None because early versions of Optik had exactly + # one short option and one long option, either of which + # could be None. +- opts = filter(None, opts) ++ opts = [_f for _f in opts if _f] + if not opts: + raise TypeError("at least one option string must be supplied") + return opts +@@ -239,7 +233,7 @@ class Option: + + def _set_attrs(self, attrs): + for attr in self.ATTRS: +- if attrs.has_key(attr): ++ if attr in attrs: + setattr(self, attr, attrs[attr]) + del attrs[attr] + else: +@@ -248,7 +242,7 @@ class Option: + else: + setattr(self, attr, None) + if attrs: +- attrs = attrs.keys() ++ attrs = list(attrs.keys()) + attrs.sort() + raise OptionError( + "invalid keyword arguments: %s" % ", ".join(attrs), +@@ -278,8 +272,8 @@ class Option: + # complicated check of __builtin__ is only necessary for + # Python 2.1 and earlier, and is short-circuited by the + # first check on modern Pythons.) +- import __builtin__ +- if ( type(self.type) is types.TypeType or ++ import builtins ++ if ( type(self.type) is type or + (hasattr(self.type, "__name__") and + getattr(__builtin__, self.type.__name__, None) is self.type) ): + self.type = self.type.__name__ +@@ -298,7 +292,7 @@ class Option: + if self.choices is None: + raise OptionError( + "must supply a list of choices for type 'choice'", self) +- elif type(self.choices) not in (types.TupleType, types.ListType): ++ elif type(self.choices) not in (tuple, list): + raise OptionError( + "choices must be a list of strings ('%s' supplied)" + % str(type(self.choices)).split("'")[1], self) +@@ -342,12 +336,12 @@ class Option: + raise OptionError( + "callback not callable: %r" % self.callback, self) + if (self.callback_args is not None and +- type(self.callback_args) is not types.TupleType): ++ type(self.callback_args) is not tuple): + raise OptionError( + "callback_args, if supplied, must be a tuple: not %r" + % self.callback_args, self) + if (self.callback_kwargs is not None and +- type(self.callback_kwargs) is not types.DictType): ++ type(self.callback_kwargs) is not dict): + raise OptionError( + "callback_kwargs, if supplied, must be a dict: not %r" + % self.callback_kwargs, self) +@@ -444,7 +438,7 @@ class Option: + parser.print_version() + parser.exit() + else: +- raise RuntimeError, "unknown action %r" % self.action ++ raise RuntimeError("unknown action %r" % self.action) + + return 1 + +--- lib/option_parser.py.orig 2006-07-23 15:21:30 UTC ++++ lib/option_parser.py +@@ -23,20 +23,14 @@ __all__ = ['SUPPRESS_HELP', 'SUPPRESS_USAGE', + SUPPRESS_HELP = "SUPPRESS"+"HELP" + SUPPRESS_USAGE = "SUPPRESS"+"USAGE" + +-# For compatibility with Python 2.2 +-try: +- True, False +-except NameError: +- (True, False) = (1, 0) +- + def isbasestring(x): +- return isinstance(x, types.StringType) or isinstance(x, types.UnicodeType) ++ return isinstance(x, bytes) or isinstance(x, str) + + class Values: + + def __init__(self, defaults=None): + if defaults: +- for (attr, val) in defaults.items(): ++ for (attr, val) in list(defaults.items()): + setattr(self, attr, val) + + def __str__(self): +@@ -47,7 +41,7 @@ class Values: + def __cmp__(self, other): + if isinstance(other, Values): + return cmp(self.__dict__, other.__dict__) +- elif isinstance(other, types.DictType): ++ elif isinstance(other, dict): + return cmp(self.__dict__, other) + else: + return -1 +@@ -60,7 +54,7 @@ class Values: + are silently ignored. + """ + for attr in dir(self): +- if dict.has_key(attr): ++ if attr in dict: + dval = dict[attr] + if dval is not None: + setattr(self, attr, dval) +@@ -79,7 +73,7 @@ class Values: + elif mode == "loose": + self._update_loose(dict) + else: +- raise ValueError, "invalid update mode: %r" % mode ++ raise ValueError("invalid update mode: %r" % mode) + + def read_module(self, modname, mode="careful"): + __import__(modname) +@@ -88,7 +82,7 @@ class Values: + + def read_file(self, filename, mode="careful"): + vars = {} +- execfile(filename, vars) ++ exec(compile(open(filename, "rb").read(), filename, 'exec'), vars) + self._update(vars, mode) + + def ensure_value(self, attr, value): +@@ -158,7 +152,7 @@ class OptionContainer: + + def set_conflict_handler(self, handler): + if handler not in ("error", "resolve"): +- raise ValueError, "invalid conflict_resolution value %r" % handler ++ raise ValueError("invalid conflict_resolution value %r" % handler) + self.conflict_handler = handler + + def set_description(self, description): +@@ -180,10 +174,10 @@ class OptionContainer: + def _check_conflict(self, option): + conflict_opts = [] + for opt in option._short_opts: +- if self._short_opt.has_key(opt): ++ if opt in self._short_opt: + conflict_opts.append((opt, self._short_opt[opt])) + for opt in option._long_opts: +- if self._long_opt.has_key(opt): ++ if opt in self._long_opt: + conflict_opts.append((opt, self._long_opt[opt])) + + if conflict_opts: +@@ -208,14 +202,14 @@ class OptionContainer: + """add_option(Option) + add_option(opt_str, ..., kwarg=val, ...) + """ +- if type(args[0]) is types.StringType: ++ if type(args[0]) is bytes: + option = self.option_class(*args, **kwargs) + elif len(args) == 1 and not kwargs: + option = args[0] + if not isinstance(option, Option): +- raise TypeError, "not an Option instance: %r" % option ++ raise TypeError("not an Option instance: %r" % option) + else: +- raise TypeError, "invalid arguments" ++ raise TypeError("invalid arguments") + + self._check_conflict(option) + +@@ -229,7 +223,7 @@ class OptionContainer: + if option.dest is not None: # option has a dest, we need a default + if option.default is not NO_DEFAULT: + self.defaults[option.dest] = option.default +- elif not self.defaults.has_key(option.dest): ++ elif option.dest not in self.defaults: + self.defaults[option.dest] = None + + return option +@@ -245,8 +239,8 @@ class OptionContainer: + self._long_opt.get(opt_str)) + + def has_option(self, opt_str): +- return (self._short_opt.has_key(opt_str) or +- self._long_opt.has_key(opt_str)) ++ return (opt_str in self._short_opt or ++ opt_str in self._long_opt) + + def remove_option(self, opt_str): + option = self._short_opt.get(opt_str) +@@ -519,16 +513,16 @@ class OptionParser (OptionContainer): + + def add_option_group(self, *args, **kwargs): + # XXX lots of overlap with OptionContainer.add_option() +- if type(args[0]) is types.StringType: ++ if type(args[0]) is bytes: + group = OptionGroup(self, *args, **kwargs) + elif len(args) == 1 and not kwargs: + group = args[0] + if not isinstance(group, OptionGroup): +- raise TypeError, "not an OptionGroup instance: %r" % group ++ raise TypeError("not an OptionGroup instance: %r" % group) + if group.parser is not self: +- raise ValueError, "invalid OptionGroup (wrong parser)" ++ raise ValueError("invalid OptionGroup (wrong parser)") + else: +- raise TypeError, "invalid arguments" ++ raise TypeError("invalid arguments") + + self.option_groups.append(group) + return group +@@ -582,7 +576,7 @@ class OptionParser (OptionContainer): + + try: + stop = self._process_args(largs, rargs, values) +- except (BadOptionError, OptionValueError), err: ++ except (BadOptionError, OptionValueError) as err: + self.error(str(err)) + + args = largs + rargs +@@ -784,7 +778,7 @@ class OptionParser (OptionContainer): + or not defined. + """ + if self.usage: +- print >>file, self.get_usage() ++ print(self.get_usage(), file=file) + + def get_version(self): + if self.version: +@@ -801,7 +795,7 @@ class OptionParser (OptionContainer): + name. Does nothing if self.version is empty or undefined. + """ + if self.version: +- print >>file, self.get_version() ++ print(self.get_version(), file=file) + + def format_option_help(self, formatter=None): + if formatter is None: +@@ -864,11 +858,11 @@ def _match_abbrev(s, wordmap): + 'words', raise BadOptionError. + """ + # Is there an exact match? +- if wordmap.has_key(s): ++ if s in wordmap: + return s + else: + # Isolate all words with s as a prefix. +- possibilities = [word for word in wordmap.keys() ++ possibilities = [word for word in list(wordmap.keys()) + if word.startswith(s)] + # No exact match, so there had better be just one possibility. + if len(possibilities) == 1: +--- lib/textwrap.py.orig 2006-04-20 01:06:35 UTC ++++ lib/textwrap.py +@@ -10,14 +10,6 @@ __revision__ = "$Id: textwrap.py 39169 2005-07-15 06:5 + import string, re + import types + +-# Do the right thing with boolean values for all known Python versions +-# (so this module can be copied to projects that don't depend on Python +-# 2.3, e.g. Optik and Docutils). +-try: +- True, False +-except NameError: +- (True, False) = (1, 0) +- + __all__ = ['TextWrapper', 'wrap', 'fill'] + + # Hardcode the recognized whitespace characters to the US-ASCII +@@ -69,7 +61,7 @@ class TextWrapper: + whitespace_trans = string.maketrans(_whitespace, ' ' * len(_whitespace)) + + unicode_whitespace_trans = {} +- uspace = ord(u' ') ++ uspace = ord(' ') + for x in map(ord, _whitespace): + unicode_whitespace_trans[x] = uspace + +@@ -122,9 +114,9 @@ class TextWrapper: + if self.expand_tabs: + text = text.expandtabs() + if self.replace_whitespace: +- if isinstance(text, types.StringType): ++ if isinstance(text, bytes): + text = text.translate(self.whitespace_trans) +- elif isinstance(text, types.UnicodeType): ++ elif isinstance(text, str): + text = text.translate(self.unicode_whitespace_trans) + return text + +@@ -141,7 +133,7 @@ class TextWrapper: + 'use', ' ', 'the', ' ', '-b', ' ', 'option!' + """ + chunks = self.wordsep_re.split(text) +- chunks = filter(None, chunks) ++ chunks = [_f for _f in chunks if _f] + return chunks + + def _fix_sentence_endings(self, chunks):