Re: [gentoo-portage-dev] [PATCH] QA-warn about systemd units using /etc/conf.d.
Dnia 2014-07-25, o godz. 00:25:38 Michał Górny napisał(a): > --- > bin/misc-functions.sh | 15 +++ > 1 file changed, 15 insertions(+) This one's in git now. -- Best regards, Michał Górny signature.asc Description: PGP signature
Re: [gentoo-portage-dev] [PATCH] Use __future__ to enable floating-point division of integers in Python 2.
Dnia 2014-08-11, o godz. 21:51:34 Michał Górny napisał(a): > In Python 2, the division ('/') operator defaults to integer > (truncating) division when given integer argument. In Python 3, it > performs floating-point division unconditionally instead. To overcome > this difference and get a consistent behavior, integers were converted > to floats explicitly in a few places. > > Instead, use a simpler 'from __future__ import division' statement that > enables floating-point division globally in Python 2. Use it in all > relevant files to get a consistent behavior, and use '//' appropriately > whenever integer division is desired. More specifically, this one's in git. Sorry for the extra thread. -- Best regards, Michał Górny signature.asc Description: PGP signature
Re: [gentoo-portage-dev] [PATCH] localized_size(): fix rounding in Python 2.
Dnia 2014-08-06, o godz. 19:12:40 Michał Górny napisał(a): > In Python 2, the '/' division operator defaults to integer division when > given integer argument. Therefore, the calculated size is trimmed before > we attempt to round it up. Instead, convert it to float first to > guarantee floating point division. This one got superseded by the __future__ division patch. -- Best regards, Michał Górny signature.asc Description: PGP signature
Re: [gentoo-portage-dev] [PATCH] repoman: fix atom.blocker checks.
Dnia 2014-08-04, o godz. 11:02:27 Michał Górny napisał(a): > The original checks assume that no-blocker is denoted as 'None'. > However, currently atom.blocker returns just 'False'. This one got into git a while ago, and it'll go live in the next release. -- Best regards, Michał Górny signature.asc Description: PGP signature
Re: [gentoo-portage-dev] [PATCH] QA: use pngfix to find broken PNG files.
Dnia 2014-07-26, o godz. 08:50:43 Michał Górny napisał(a): > --- > bin/misc-functions.sh | 26 ++ > 1 file changed, 26 insertions(+) This one's in git too. -- Best regards, Michał Górny signature.asc Description: PGP signature
Re: [gentoo-portage-dev] [PATCH] Use __future__ to enable floating-point division of integers in Python 2.
Dnia 2014-08-06, o godz. 19:26:08 Michał Górny napisał(a): > In Python 2, the division ('/') operator defaults to integer > (truncating) division when given integer argument. In Python 3, it > performs floating-point division unconditionally instead. To overcome > this difference and get a consistent behavior, integers were converted > to floats explicitly in a few places. > > Instead, use a simpler 'from __future__ import division' statement that > enables floating-point division globally in Python 2. The updated patch is in git now. -- Best regards, Michał Górny signature.asc Description: PGP signature
[gentoo-portage-dev] [PATCH] Enable testing using travis-ci.
Make it easy to use travis-ci for testing on github mirror and forks. X-Pull-Request: https://github.com/gentoo/portage/pull/3 --- .travis.yml | 10 ++ 1 file changed, 10 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000..6c8d873 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,10 @@ +language: python +python: +- 2.6 +- 2.7 +- 3.2 +- 3.3 +- 3.4 +- pypy +script: +- python -b -Wd pym/portage/tests/runTests -- 2.0.4
[gentoo-portage-dev] [PATCH v2] Use __future__ to enable floating-point division of integers in Python 2.
In Python 2, the division ('/') operator defaults to integer (truncating) division when given integer argument. In Python 3, it performs floating-point division unconditionally instead. To overcome this difference and get a consistent behavior, integers were converted to floats explicitly in a few places. Instead, use a simpler 'from __future__ import division' statement that enables floating-point division globally in Python 2. Use it in all relevant files to get a consistent behavior, and use '//' appropriately whenever integer division is desired. X-Pull-Request: https://github.com/gentoo/portage/pull/2 --- pym/_emerge/Scheduler.py | 2 +- pym/_emerge/actions.py | 2 +- pym/_emerge/depgraph.py | 4 ++-- pym/_emerge/sync/old_tree_timestamp.py | 10 ++ pym/portage/_emirrordist/FetchTask.py| 4 +++- pym/portage/_sets/dbapi.py | 2 ++ pym/portage/cache/sqlite.py | 4 ++-- pym/portage/dbapi/vartree.py | 4 ++-- pym/portage/localization.py | 2 ++ pym/portage/output.py| 6 -- pym/portage/util/_eventloop/EventLoop.py | 6 -- pym/portage/util/_eventloop/PollSelectAdapter.py | 4 +++- 12 files changed, 32 insertions(+), 18 deletions(-) diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py index dd268f7..d6db311 100644 --- a/pym/_emerge/Scheduler.py +++ b/pym/_emerge/Scheduler.py @@ -1,7 +1,7 @@ # Copyright 1999-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -from __future__ import print_function, unicode_literals +from __future__ import division, print_function, unicode_literals from collections import deque import gc diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index b935139..fd2ad89 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -1,7 +1,7 @@ # Copyright 1999-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -from __future__ import print_function, unicode_literals +from __future__ import division, print_function, unicode_literals import errno import logging diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index acb1db1..a10297a 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -1,7 +1,7 @@ # Copyright 1999-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -from __future__ import print_function, unicode_literals +from __future__ import division, print_function, unicode_literals import collections import errno @@ -8446,7 +8446,7 @@ def _backtrack_depgraph(settings, trees, myopts, myparams, myaction, myfiles, sp debug = "--debug" in myopts mydepgraph = None max_retries = myopts.get('--backtrack', 10) - max_depth = max(1, (max_retries + 1) / 2) + max_depth = max(1, (max_retries + 1) // 2) allow_backtracking = max_retries > 0 backtracker = Backtracker(max_depth) backtracked = 0 diff --git a/pym/_emerge/sync/old_tree_timestamp.py b/pym/_emerge/sync/old_tree_timestamp.py index 9b35aed..8411cae 100644 --- a/pym/_emerge/sync/old_tree_timestamp.py +++ b/pym/_emerge/sync/old_tree_timestamp.py @@ -1,6 +1,8 @@ # Copyright 2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +from __future__ import division + import locale import logging import time @@ -27,16 +29,16 @@ def whenago(seconds): out = [] if sec > 60: - mins = sec / 60 + mins = sec // 60 sec = sec % 60 if mins > 60: - hrs = mins / 60 + hrs = mins // 60 mins = mins % 60 if hrs > 24: - days = hrs / 24 + days = hrs // 24 hrs = hrs % 24 if days > 365: - years = days / 365 + years = days // 365 days = days % 365 if years: diff --git a/pym/portage/_emirrordist/FetchTask.py b/pym/portage/_emirrordist/FetchTask.py index 66c41c1..20e93fc 100644 --- a/pym/portage/_emirrordist/FetchTask.py +++ b/pym/portage/_emirrordist/FetchTask.py @@ -1,6 +1,8 @@ # Copyright 2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +from __future__ import division + import collections import errno import logging @@ -242,7 +244,7 @@ class FetchTask(CompositeTask): remaining_tries = self.config.options.tries - len(self._tried_uris) if remaining_tries > 0: - if remaining_tries <= self.config.options.tries / 2: + if remaining_tries <= self.config.options.tries // 2: while self._primaryuri_stack: uri = self._pri
[gentoo-portage-dev] [PATCH] Use __future__ to enable floating-point division of integers in Python 2.
In Python 2, the division ('/') operator defaults to integer (truncating) division when given integer argument. In Python 3, it performs floating-point division unconditionally instead. To overcome this difference and get a consistent behavior, integers were converted to floats explicitly in a few places. Instead, use a simpler 'from __future__ import division' statement that enables floating-point division globally in Python 2. Use it in all relevant files to get a consistent behavior, and use '//' appropriately whenever integer division is desired. Reviewed-by: Arfrever Frehtes Taifersar Arahesis X-Pull-Request: https://github.com/gentoo/portage/pull/2 --- bin/quickpkg | 4 ++-- pym/_emerge/Scheduler.py | 2 +- pym/_emerge/actions.py | 10 +- pym/_emerge/depgraph.py | 4 ++-- pym/_emerge/sync/old_tree_timestamp.py | 12 +++- pym/portage/_emirrordist/FetchTask.py| 6 -- pym/portage/_sets/dbapi.py | 4 +++- pym/portage/cache/sqlite.py | 4 ++-- pym/portage/dbapi/vartree.py | 4 ++-- pym/portage/localization.py | 2 ++ pym/portage/output.py| 6 -- pym/portage/util/_eventloop/EventLoop.py | 8 +--- pym/portage/util/_eventloop/PollSelectAdapter.py | 6 -- 13 files changed, 43 insertions(+), 29 deletions(-) diff --git a/bin/quickpkg b/bin/quickpkg index 90277ad..035131e 100755 --- a/bin/quickpkg +++ b/bin/quickpkg @@ -2,7 +2,7 @@ # Copyright 1999-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -from __future__ import print_function +from __future__ import division, print_function import errno import math @@ -264,7 +264,7 @@ def quickpkg_main(options, args, eout): size_str = "0" else: power_of_2 = math.log(size, 2) - power_of_2 = 10*int(power_of_2/10) + power_of_2 = 10*(power_of_2//10) unit = units.get(power_of_2) if unit: size = float(size)/(2**power_of_2) diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py index dd268f7..d6db311 100644 --- a/pym/_emerge/Scheduler.py +++ b/pym/_emerge/Scheduler.py @@ -1,7 +1,7 @@ # Copyright 1999-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -from __future__ import print_function, unicode_literals +from __future__ import division, print_function, unicode_literals from collections import deque import gc diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index b935139..e482744 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -1,7 +1,7 @@ # Copyright 1999-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -from __future__ import print_function, unicode_literals +from __future__ import division, print_function, unicode_literals import errno import logging @@ -1499,14 +1499,14 @@ def action_info(settings, trees, myopts, myfiles): vm_info = get_vm_info() if "ram.total" in vm_info: - line = "%-9s %10d total" % ("KiB Mem:", vm_info["ram.total"] / 1024) + line = "%-9s %10d total" % ("KiB Mem:", vm_info["ram.total"] // 1024) if "ram.free" in vm_info: - line += ",%10d free" % (vm_info["ram.free"] / 1024,) + line += ",%10d free" % (vm_info["ram.free"] // 1024,) append(line) if "swap.total" in vm_info: - line = "%-9s %10d total" % ("KiB Swap:", vm_info["swap.total"] / 1024) + line = "%-9s %10d total" % ("KiB Swap:", vm_info["swap.total"] // 1024) if "swap.free" in vm_info: - line += ",%10d free" % (vm_info["swap.free"] / 1024,) + line += ",%10d free" % (vm_info["swap.free"] // 1024,) append(line) lastSync = portage.grabfile(os.path.join( diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index acb1db1..a10297a 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -1,7 +1,7 @@ # Copyright 1999-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -from __future__ import print_function, unicode_literals +from __future__ import division, print_function, unicode_literals import collections import errno @@ -8446,7 +8446,7 @@ def _backtrack_depgraph(settings, trees, myopts, myparams, myaction, myfiles, sp debug = "--debug" in myopts mydepgraph = None max_retries = myopts.get('--backtrack', 10) - max_depth = max(1, (max_retries + 1) / 2) + max_depth = max(1, (max_retries + 1) //