Commit Graph

1225 Commits

Author SHA1 Message Date
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
Ettore Di Giacinto 23f2e55879 Release Entropy 324 2020-02-07 16:25:39 +01:00
Ettore Di Giacinto 285876cc86 Release Entropy 323 2019-12-16 23:38:39 +01:00
Sławomir Nizio e26d11b5f6 Python 3 fixes: open() and so, not file() 2019-12-04 22:01:22 +01:00
Ettore Di Giacinto d2328561d9 Release Entropy 322 2019-11-10 15:53:52 +01:00
Ettore Di Giacinto 00afcc3c10 Release Entropy 321 2019-11-10 15:44:18 +01:00
Ettore Di Giacinto f2cac41869 Release Entropy 320 2019-11-07 17:21:28 +01:00
Ettore Di Giacinto 35a3fa3c75 Merge pull request #68 from Enlik/modules-reorg
Make Entropy able to work from within Python site directory
2019-03-13 22:48:40 +01:00
Daniele Rondina 215e5b019e eit: Add --reset-revision option to inject command 2019-03-01 19:02:56 +01:00
Sławomir Nizio 321d59614f update eit imports + minor rename in entropy_path_loader 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 e16a1585ec Release Entropy 319 2018-11-22 21:59:03 +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 c0b065fbff Release Entropy 318 2018-11-03 20:18:26 +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 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 a7171bdc7e Release Entropy 317 2018-09-23 22:29:48 +02:00
Fabio Erculiani f0e6b09ee2 Release Entropy 316 2018-09-23 15:41:48 +02:00
Fabio Erculiani a5890973b1 Release Entropy 315 2018-09-22 19:39:42 +02:00
Ettore Di Giacinto d420cf5774 Release Entropy 314 2018-09-08 23:16:57 +02:00
Fabio Erculiani 12aafd8e5e Release Entropy 313 2018-08-18 09:25:08 +02:00
Sławomir Nizio 9db87b99c3 [equo, eit] update man pages 2018-08-06 22:45:32 +02:00
Ettore Di Giacinto 9e427b7c9b Release Entropy 312 2018-07-11 18:10:19 +02:00
Ettore Di Giacinto f63815cb79 [server/po] Update translations 2018-06-03 09:25:07 +02:00
Ettore Di Giacinto 1d6fde589e Release Entropy 311 2018-05-30 22:13:29 +02:00
Geaaru d36bef4f79 [eit] Add --quick option to inject command 2018-03-26 23:55:29 +02:00
Geaaru 9781fa409f [eit] Fix pass of ask attribute to add_packages_to_repository function on commit command. 2017-12-26 17:03:49 +01:00
Fabio Erculiani 8d0f16d9d5 Release Entropy 310 2017-10-08 22:25:58 +02:00
Fabio Erculiani 330ffd1926 Release Entropy 309 2017-09-10 19:08:33 +02:00
Francesco Ferro cac8ad2b29 Release Entropy 308 2017-09-09 18:46:39 +02:00
Fabio Erculiani b2d0ca8707 Release Entropy 307 2017-05-13 14:36:24 +02:00
Fabio Erculiani c611f76a33 Release Entropy 306 2016-11-20 08:07:36 +01:00
Fabio Erculiani b95b0d80b4 Release Entropy 305 2016-11-19 21:16:27 +01:00
mudler 4a0488bd41 Release Entropy 304 2016-09-18 16:54:55 +02:00
Fabio Erculiani aeaf05fe4d Release Entropy 303 2016-07-08 09:04:30 +02:00
mudler 2ab2130714 Release Entropy 302 2016-05-16 22:22:26 +02:00
Fabio Erculiani 96ed6d3c5e Release Entropy 301 2016-03-20 19:32:33 +01:00
Fabio Erculiani 91ed0f744d Update translations 2016-03-20 19:32:01 +01:00
Fabio Erculiani 5ea91aefd7 Release Entropy 300 2015-10-29 19:03:36 +01:00
Fabio Erculiani baa30318e1 Release Entropy 299 2015-10-29 18:54:00 +01:00
Fabio Erculiani da39ba3ad9 Release Entropy 298 2015-08-22 23:49:00 +01:00
Fabio Erculiani dd2e9560a3 Release Entropy 297 2015-06-03 06:50:08 +01:00
Fabio Erculiani 1e83c54741 Release Entropy 296 2015-03-17 16:16:54 +00:00
Fabio Erculiani c875341fa5 Release Entropy 295 2015-01-13 10:19:05 +00:00
Fabio Erculiani 0baa8ffedc Release Entropy 294 2015-01-10 07:33:45 +00:00
Fabio Erculiani 4e0232f22e Release Entropy 293 2014-11-30 14:57:24 +00:00
Fabio Erculiani 6940a64e76 Release Entropy 292 2014-10-24 09:21:08 +02:00
Fabio Erculiani bb8cb2e354 Release Entropy 291 2014-10-23 19:03:20 +02:00
Fabio Erculiani 363c6a175f [entropy.*] migrate all retrieveNeeded uses to retrieveNeededLibraries 2014-10-20 15:04:19 +02:00