530 Commits

Author SHA1 Message Date
Mario Fetka
fc1d71db8e const.py, rigo: remove remaining Python 2 dead code
Simplify const_isfileobj(), const_isnumber(), const_debug_write()
and remove unreachable code in rigo/rigo/utils.py::prepare_markup().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-26 11:52:21 +02:00
Mario Fetka
7072c00a77 Python 3 modernization: low-hanging fruit cleanup
- hashlib: add usedforsecurity=False to all md5/sha1/sha256/sha512 calls
  (FIPS-mode compatibility, ~34 call sites across 13 files)
- join([listcomp]): convert to generator expressions (~15 sites)
- class Foo(object): -> class Foo: across all files (Python 3 style)
- collections.OrderedDict() -> {} in db/skel.py (Python 3.7+ dicts ordered)
- open() without context manager: fix 3 bare open/close in misc.py
- Exception chaining: add 'from err' to raise statements in portage_plugin
- const_is_python3() dead code removal:
  * Simplify 7 compat functions in const.py (const_is_python3,
    const_get_stringtype, const_isunicode, const_israwstring,
    const_get_buffer, const_convert_to_unicode, const_convert_to_rawstring,
    const_isstring, const_get_int) — remove Python 2 branches
  * Remove 100+ const_is_python3() if/else branches across 27 files,
    keeping only the Python 3 path
  * Remove cPickle import in dump.py, use plain pickle with fix_imports=True
  * Remove urllib2 dead imports in misc.py, fetchers.py
  * Clean up const_is_python3 from all import lines

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-26 11:51:29 +02:00
Sławomir Nizio
0019b6e68a [entropy.misc, rigo] fix file-like objects with Python 3
FakeOutFile and LogFile need .buffer like Python 3 "text" file objects
which is needed when in rigo standard output/error is replaced, and then
it reaches Portage which does this:

	    if sys.hexversion >= 0x3000000 and fd in (sys.stdout, sys.stderr):
		    fd = fd.buffer
    fd.write(mystr)

(/usr/lib64/python3.6/site-packages/portage/util/__init__.py).

Entropy internal code did not need this.

Note, after this commit, changes done previously:
    1)
    commit 0869912ec4

	[entropy.spm] Rigo related Python 3 fix

	  File "/usr/lib64/python3.6/site-packages/entropy/spm/plugins/interfaces/portage_plugin/__init__.py", line 101, in _pusher
	    self._std.buffer.write(chunk)
	AttributeError: 'FakeOutFile' object has no attribute 'buffer'

    2)
    commit 8700aade27

	[entropy.spm, rigo] Rigo related Python 3 fixes

	1)
	  File "/usr/lib/python-exec/python3.6/RigoDaemon_app.py", line 362, in _pusher
	    fobj.write(chunk)
	TypeError: write() argument must be str, not bytes

	2)
	  File "/usr/lib64/python3.6/site-packages/entropy/spm/plugins/interfaces/portage_plugin/__init__.py", line 77, in __init__
	    self.buffer = Writer(self, self._std.buffer)
	AttributeError: 'FakeOutFile' object has no attribute 'buffer'

    (...)

could be likely reverted; not tested, it could be better to have them anyway to
avoid futher re/encoding/checks if conversions are needed (subjective).

Fixes bug 5899.
2020-03-21 22:20:27 +01:00
Sławomir Nizio
e01746bc38 [rigo] Python 3 fix in config files viewer / editor 2020-03-13 21:48:16 +01:00
Sławomir Nizio
8700aade27 [entropy.spm, rigo] Rigo related Python 3 fixes
1)
  File "/usr/lib/python-exec/python3.6/RigoDaemon_app.py", line 362, in _pusher
    fobj.write(chunk)
TypeError: write() argument must be str, not bytes

2)
  File "/usr/lib64/python3.6/site-packages/entropy/spm/plugins/interfaces/portage_plugin/__init__.py", line 77, in __init__
    self.buffer = Writer(self, self._std.buffer)
AttributeError: 'FakeOutFile' object has no attribute 'buffer'
2020-02-11 22:26:20 +01:00
Sławomir Nizio
2aa2c69e2b correct exception handling / error reporting with Python 3 2019-12-13 01:32:09 +01:00
Sławomir Nizio
d65f09fcf8 [rigo] correct Vte.Terminal.feed with Python 3
With Python 3, prepare_markup() doesn't now convert string to bytes.
2019-12-05 23:28:27 +01:00
Sławomir Nizio
842979cbba [magneto, rigo] Python 3 fixes in _dbus_to_string 2019-12-05 22:41:53 +01:00
Sławomir Nizio
97409d12d5 [rigo] Python 3 fixes 2019-12-05 22:34:42 +01:00
Sławomir Nizio
e26d11b5f6 Python 3 fixes: open() and so, not file() 2019-12-04 22:01:22 +01:00
Sławomir Nizio
ed93a3737d update RigoDaemon imports 2018-11-26 20:15:36 +01:00
Sławomir Nizio
503e7077f3 update rigo imports 2018-11-26 20:15:36 +01:00
Sławomir Nizio
6d4a3f09e6 makefiles: establish a layout for sitedir installs
The idea is that:
- entropy.* imports will work as before (so any 3rd party clients will
  work as always) - installed in "entropy" package,
- new "_entropy" package to hold a namespace for private modules (like
  ones that required adding special directories to sys.path).
  (Underscored name for a top level Python module is not very common...
  anyway, it was inspired by "_emerge.")

Layout:
site-packages/
    entropy (backwards compatible)
	const.py
	...
    kswitch (also toplevel to keep compatibility)
	...
    _entropy
	eit
	magneto
	matter
	rigo
	RigoDaemon
	solo

(Note that site-packages does not need to be actually Python's
site-packages directory but anything as it is controlled by an argument
to make. It is however intended to be the sitedir.)

Another idea for a layout would be one that mimics sources checkout, but
the layout there is somewhat scattered. (And some ugliness would be
needed to make them modules before implicit namespaces from Python 3.3.
Anyway, imports would be long and ugly.)

Now, the layout of installed Entropy is lean; installation to virtualenv
is also possible (though there would be a need to call scripts like
"python equo.py" as shebangs are not converted).

Follow up changes are needed to make it work.
2018-11-26 20:15:36 +01:00
Sławomir Nizio
252c260f06 use entropy_path_loader only for running from the checkout
After this commit alone it would not work when installed (unless module
paths are set in a special way). Next changes will introduce
installation to site-packages so no custom PYTHONPATH will be necessary.
2018-11-26 20:15:36 +01:00
Ettore Di Giacinto
450456a4ec Merge pull request #65 from Enlik/modules-reorg
Preparation for installation in Python-specific directories
2018-11-16 18:29:44 +01:00
Fabio Erculiani
5097f7d7a4 Rigo: fix LTS and non-LTS kernel menu.
Since Gentoo EAPI=7, old-style virtual packages have been removed.
We will use KernelSwitcher to get a list of kernel packages to show.
2018-11-03 20:15:44 +01:00
Sławomir Nizio
33966f4f31 [*] allow setting PYTHON_SITEDIR for make
This way a proper separation between Python installs can be achieved.

With no PYTHON_SITEDIR, installation paths are exactly the same as
before this change.

In practise, passing nonstandard path will break Entropy but so it is
also with the currently available LIBDIR. This is a concern of a future
improvement (at least the PYTHON_SITEDIR path, not necessarily LIBDIR as
PYTHON_SITEDIR *will* be different if it's installed in Python specific
directories).
2018-10-28 21:44:54 +01:00
Sławomir Nizio
0ccbc1f093 [Rigo] update ("reformat" only) translations
Due to a change of a .py file.
2018-10-28 19:53:53 +01:00
Sławomir Nizio
96909f6d29 [rigo/po] add RigoDaemon_app.py to POTFILES.in 2018-10-28 19:50:46 +01:00
Sławomir Nizio
90ecb5b00d [RigoDaemon] make the application part be in /usr/libexec
This way there is no hardcoded /usr/lib/rigo, and the "executable" part
is in a well known location which can be replicated on system for
different Python implementations. (As in: it will be like /usr/bin/foo.py
which on Gentoo links to a system wrapper making it use configured
Python.)
2018-10-28 19:16:54 +01:00
Sławomir Nizio
41ba9b6d63 [*] be strict about Python modules paths being loaded
For convenience (seemingly, and it really is convenient) equo and other
tools can be run from the checkout, and Entropy modules are loaded from
the checkout. Now there is a strict separation when system paths and
when paths from the checkout are used.

It makes it a bit more robust, secure and preditable at the cost of
a little more complexity.

A pleasant side effect of this change is that it is not required to
change directory to the tool (to use non-system one), as paths in the
checkout are relative to scripts.

Imports in lib/tests were not adjusted.
2018-10-27 13:03:58 +02:00
Fabio Erculiani
afda55090e [rigo/po] update translations for Rigo. 2018-09-23 15:41:21 +02:00
Fabio Erculiani
5182a5cfea [rigo/pot] update rigo.pot 2018-09-23 15:40:45 +02:00
Ettore Di Giacinto
dd36b7e8cd [rigo/po] Update translations 2018-06-03 09:25:39 +02:00
Fabio Erculiani
2d65d5b7bf [entropy.client] fix conflicts removal handling during upgrade.
In certain extreme situations, that are more likely if the install
state is old (e.g. 9 months +), Entropy may decide to remove packages
due to conflicts with the version being installed and shoot itself
in the foot, if this is the case of dev-lang/python :-).

So, this commit tries to avoid the scenario by filtering out package
removals for those that are being installed anyway as part of the
transaction (e.g. a system upgrade).

This should fix the very specific case, but increase uncertainty
and thus entropy in other cases where once a package that lists
conflicts is installed, it may not expect to find that package
installed. However, this case should be handled by the dependency
graph generator (and it currently does not), which would need to
reorder the execution of the queue to comply with conflicts.

Perhaps, someone in the future will improve that too, for now,
let's enjoy one more snowflake.

Current improvement:
- foo-1 and bar-2 are set to be installed
- foo-1 conflicts with <bar-2
- bar-1 is installed
- foo-1 wanted to remove bar-1 as part of foo-1 install transaction.
  (now fixed, it won't...)
- bar-2 is then installed

Better improvement:
- foo-1 and bar-2 are set to be installed
- foo-1 conflicts with <bar-2 (but bar-2 itself can be installed
  and does not conflict with foo-1)
- bar-2 is set to be installed before foo-1
- when entropy gets to foo-1 there is nothing to remove
2017-10-08 21:51:07 +02:00
Fabio Erculiani
18fa7ebf5d [RigoDaemon] fix typo in debug string name 2017-10-08 21:14:51 +02:00
Fabio Erculiani
98cd2b2b9f [rigo] Force terminal expansion, fixes bug #5305 2016-11-19 21:14:41 +01:00
Sławomir Nizio
e96db09ad7 [solo.commands,lib] display packages that pull in conflicting ones 2016-08-05 20:00:21 +02:00
Fabio Erculiani
91ed0f744d Update translations 2016-03-20 19:32:01 +01:00
Fabio Erculiani
edcd57c9de [Rigo] Gtk 3.14 fixes 2015-01-13 10:18:46 +00:00
Fabio Erculiani
265eb182f8 [Rigo] fix various deprecation warnings 2015-01-04 16:13:12 +00:00
Fabio Erculiani
788e54ced3 [Rigo] update translations 2014-04-04 11:35:27 +02:00
Fabio Erculiani
a04e6381bb [Rigo] update translations 2014-03-16 17:03:48 +01:00
Fabio Erculiani
7bc1306d28 [Rigo] require Gtk+ 3.10 and solve all deprecation warnings related to Gtk*Box 2014-03-02 12:13:14 +01:00
Fabio Erculiani
e4411da049 [Rigo] update translations 2014-02-14 16:14:59 +01:00
Fabio Erculiani
03ef3991bd [entropy.client] refactor NoticeBoard Entropy Client API 2014-02-14 13:10:16 +01:00
Fabio Erculiani
eb64e4156a [Rigo] do not show app management buttons during upgrade 2014-01-14 09:09:19 +01:00
Fabio Erculiani
0b1b213730 [Rigo] translate IDLE DaemonAppAction as well 2014-01-14 01:01:21 +01:00
Fabio Erculiani
14cff214c6 [Rigo] Always execute _entropy_bus() from the main thread, avoids deadlocks 2014-01-14 01:00:18 +01:00
Fabio Erculiani
f9a80d7bd0 [Rigo] add IDLE to AppActions enum 2014-01-14 00:58:45 +01:00
Fabio Erculiani
7c8bfe8303 [Rigo] emit application-abort when busy() fails with BusyError 2014-01-14 00:14:09 +01:00
Fabio Erculiani
6b7e4f96c3 [Rigo] add UPGRADE to AppActions to match DaemonAppActions 2014-01-14 00:13:41 +01:00
Dušan
a03296d92d Slovak translation update
finally translated to 100%
2014-01-05 11:27:54 +01:00
Dušan
1152e6e6f0 Slovak translation update 2014-01-05 10:11:47 +01:00
Dušan
95a37ca2a2 Slovak translation update
Fixed strings with plurals
2014-01-04 22:27:40 +01:00
Fabio Erculiani
de156b083b [Rigo] change the EntropyRepository default cache policy to NONE
This saves a huge quantity of RAM, as happened with RigoDaemon
2014-01-04 11:16:00 +01:00
Fabio Erculiani
289add075b [Rigo] Update the Slovak translation, thanks to Dušan Kazik 2014-01-03 20:24:27 +01:00
Fabio Erculiani
c65d713c91 [Rigo] fix NotificationBox message_type keyword argument 2014-01-03 15:12:12 +01:00
Fabio Erculiani
cbe42edee9 [RigoDaemon] set the cache policy to EntropyRepositoryCachePolicies.NONE
This greatly reduces the memory consumption of RigoDaemon
2014-01-03 07:36:44 +01:00
Fabio Erculiani
f446b8d05b [RigoDaemon] reimplement Entropy.get_repository()
We need to monkey patch isMainThread in order to return True for
the ActionQueueWorkerThread as well. This avoids EntropySQLRepository
to initialize an infinite number of cleanup monitor threads for a
thread that will never go away (the ActionQueueWorkerThread one).
2013-12-31 17:53:22 +01:00