convert solo imports, with needed changes to entropy_path_loader

The module entropy_path_loader (used only for running from within the
checkout; otherwise not even installed) is made to provide the _entropy
namespace.

(Other ideas instead of this entropy_path_loader change would be to
reorganise files layout; drop support for running from the checkout as
is - and perhaps require virtualenvs; require sourcing a script that
sets PYTHONPATH. However, as implemented, it is not intrusive, and the
good part is that it is quite isolated, not used in normal usage after
installation. Basically, it only does sys.path + provides _entropy
namespace.)
This commit is contained in:
Sławomir Nizio
2018-11-26 20:15:36 +01:00
parent 6d4a3f09e6
commit 7cf7e1f6b7
41 changed files with 97 additions and 91 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ if os.path.isfile(osp.join(_base, "entropy-in-vcs-checkout")):
import entropy_path_loader
del osp
from solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
MAN_HEADER="""\
EQUO(1)
+1 -1
View File
@@ -11,6 +11,6 @@ if os.path.isfile(osp.join(_base, "entropy-in-vcs-checkout")):
import entropy_path_loader
del osp
from solo.main import main
from _entropy.solo.main import main
sys.argv[0] = "equo"
main()
+2 -2
View File
@@ -18,8 +18,8 @@ from entropy.client.interfaces import Client
import entropy.dep
import entropy.tools
from solo.commands.install import SoloInstall
from solo.utils import print_package_info
from _entropy.solo.commands.install import SoloInstall
from _entropy.solo.utils import print_package_info
import kswitch
+1 -1
View File
@@ -21,7 +21,7 @@ for py_file in os.listdir(_cur_dir):
if py_file.startswith("_"):
continue
# strip .py
_mod = "solo.commands." + py_file[:-3]
_mod = "_entropy.solo.commands." + py_file[:-3]
if _mod in _excluded_mods:
continue
try:
+2 -2
View File
@@ -30,8 +30,8 @@ from entropy.client.interfaces.package.preservedlibs import PreservedLibraries
import entropy.tools
import entropy.dep
from solo.utils import enlightenatom, get_entropy_webservice
from solo.commands.command import SoloCommand
from _entropy.solo.utils import enlightenatom, get_entropy_webservice
from _entropy.solo.commands.command import SoloCommand
class SoloManage(SoloCommand):
"""
+2 -2
View File
@@ -15,8 +15,8 @@ import argparse
from entropy.i18n import _
from entropy.output import blue, brown, darkgreen
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands.command import SoloCommand, sharedlock
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.command import SoloCommand, sharedlock
class SoloCache(SoloCommand):
"""
+3 -3
View File
@@ -16,9 +16,9 @@ import argparse
from entropy.i18n import _
from entropy.const import etpConst
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands.command import SoloCommand
from solo.utils import cleanup
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.command import SoloCommand
from _entropy.solo.utils import cleanup
class SoloCleanup(SoloCommand):
"""
+1 -1
View File
@@ -26,7 +26,7 @@ from entropy.core.settings.base import SystemSettings
import entropy.tools
from solo.utils import enlightenatom
from _entropy.solo.utils import enlightenatom
def _fix_argparse_print_help():
+2 -2
View File
@@ -28,8 +28,8 @@ from entropy.output import readtext, darkgreen, brown, teal, purple, \
import entropy.tools
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands.command import SoloCommand
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.command import SoloCommand
class SoloConf(SoloCommand):
+3 -3
View File
@@ -16,9 +16,9 @@ import argparse
from entropy.i18n import _
from entropy.output import darkred, darkgreen, blue, brown
from solo.utils import enlightenatom
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands._manage import SoloManage
from _entropy.solo.utils import enlightenatom
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands._manage import SoloManage
class SoloConfig(SoloManage):
"""
+2 -2
View File
@@ -16,8 +16,8 @@ import time
from entropy.i18n import _
from entropy.output import darkred, blue, darkgreen
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands.install import SoloInstall
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.install import SoloInstall
class SoloDeptest(SoloInstall):
"""
+2 -2
View File
@@ -16,8 +16,8 @@ import argparse
from entropy.i18n import _
from entropy.output import darkred, darkgreen, blue
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands._manage import SoloManage
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands._manage import SoloManage
class SoloDownload(SoloManage):
"""
+3 -3
View File
@@ -14,9 +14,9 @@ import argparse
from entropy.i18n import _
from entropy.output import teal, purple, darkgreen
from solo.colorful import ColorfulFormatter
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands.command import SoloCommand
from _entropy.solo.colorful import ColorfulFormatter
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.command import SoloCommand
class SoloHelp(SoloCommand):
"""
+2 -2
View File
@@ -16,8 +16,8 @@ from entropy.i18n import _
from entropy.output import brown, purple, teal, darkred, bold, \
red, darkgreen
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands.command import SoloCommand, exclusivelock
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.command import SoloCommand, exclusivelock
class SoloHop(SoloCommand):
"""
+3 -3
View File
@@ -23,9 +23,9 @@ from entropy.client.interfaces.package.actions.action import PackageAction
import entropy.tools
from solo.utils import enlightenatom
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands._manage import SoloManage
from _entropy.solo.utils import enlightenatom
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands._manage import SoloManage
class SoloInstall(SoloManage):
"""
+2 -2
View File
@@ -16,8 +16,8 @@ import time
from entropy.i18n import _
from entropy.output import blue, darkred, brown, purple, teal, darkgreen
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands.install import SoloInstall
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.install import SoloInstall
class SoloLibtest(SoloInstall):
"""
+2 -2
View File
@@ -16,8 +16,8 @@ from entropy.i18n import _
from entropy.const import etpConst, const_convert_to_unicode
from entropy.output import darkred, red, blue, brown, teal, purple
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands.command import SoloCommand, exclusivelock
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.command import SoloCommand, exclusivelock
class SoloMark(SoloCommand):
+3 -3
View File
@@ -17,9 +17,9 @@ from entropy.const import const_convert_to_unicode
from entropy.output import purple, teal, darkred, brown, red, \
darkgreen, blue
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands.command import SoloCommand
from solo.utils import enlightenatom
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.command import SoloCommand
from _entropy.solo.utils import enlightenatom
class SoloMaskUnmask(SoloCommand):
+3 -3
View File
@@ -15,9 +15,9 @@ import argparse
from entropy.i18n import _, ngettext
from entropy.output import darkred, blue, brown, darkgreen, purple
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands.command import SoloCommand, sharedlock
from solo.utils import print_table, print_package_info
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.command import SoloCommand, sharedlock
from _entropy.solo.utils import print_table, print_package_info
import entropy.dep
+2 -2
View File
@@ -13,8 +13,8 @@ import argparse
from entropy.i18n import _
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands.command import SoloCommand
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.command import SoloCommand
class SoloFunny(SoloCommand):
+2 -2
View File
@@ -17,8 +17,8 @@ from entropy.output import darkred, blue, brown, darkgreen
from entropy.client.interfaces.noticeboard import NoticeBoard
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands.command import SoloCommand
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.command import SoloCommand
class SoloNotice(SoloCommand):
"""
+2 -2
View File
@@ -23,8 +23,8 @@ from entropy.output import darkgreen, teal, brown, purple, darkred, blue
import entropy.tools
import entropy.dep
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands.command import SoloCommand, sharedlock
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.command import SoloCommand, sharedlock
class SoloPkg(SoloCommand):
+3 -3
View File
@@ -18,10 +18,10 @@ from entropy.output import brown, blue, darkred, darkgreen, purple, teal
from entropy.client.interfaces.package import preservedlibs
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands.command import SoloCommand, sharedlock
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.command import SoloCommand, sharedlock
from solo.utils import enlightenatom
from _entropy.solo.utils import enlightenatom
class SoloPreservedLibs(SoloCommand):
+5 -5
View File
@@ -22,10 +22,10 @@ from entropy.output import darkgreen, darkred, blue, teal, purple, brown, \
import entropy.tools
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands.command import SoloCommand, sharedlock
from solo.utils import print_package_info, print_table, get_file_mime, \
graph_packages, revgraph_packages
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.command import SoloCommand, sharedlock
from _entropy.solo.utils import print_package_info, print_table, \
get_file_mime, graph_packages, revgraph_packages
class SoloQuery(SoloCommand):
@@ -725,7 +725,7 @@ Repository query tools.
Solo Query Installed command.
Alias of "solo search --installed".
"""
from solo.commands.search import SoloSearch
from _entropy.solo.commands.search import SoloSearch
search = SoloSearch(
self._nsargs, quiet=self._nsargs.quiet,
verbose=self._nsargs.verbose,
+3 -3
View File
@@ -21,9 +21,9 @@ from entropy.exceptions import DependenciesNotRemovable
import entropy.tools
from solo.utils import enlightenatom
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands._manage import SoloManage
from _entropy.solo.utils import enlightenatom
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands._manage import SoloManage
class SoloRemove(SoloManage):
"""
+3 -3
View File
@@ -21,9 +21,9 @@ from entropy.const import etpConst
import entropy.tools
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands.command import SoloCommand
from solo.utils import print_table
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.command import SoloCommand
from _entropy.solo.utils import print_table
class SoloRepo(SoloCommand):
"""
+3 -2
View File
@@ -23,8 +23,9 @@ from entropy.exceptions import SystemDatabaseError
from entropy.db.exceptions import OperationalError, DatabaseError
from entropy.client.interfaces.db import InstalledPackagesRepository
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands.command import SoloCommand, sharedlock, exclusivelock
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.command import SoloCommand, sharedlock, \
exclusivelock
import entropy.dep
import entropy.tools
+3 -3
View File
@@ -15,9 +15,9 @@ import argparse
from entropy.i18n import _, ngettext
from entropy.output import darkred, blue, brown, darkgreen, purple
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands.command import SoloCommand, sharedlock
from solo.utils import print_table, print_package_info
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.command import SoloCommand, sharedlock
from _entropy.solo.utils import print_table, print_package_info
import entropy.dep
+3 -3
View File
@@ -19,9 +19,9 @@ from entropy.output import darkgreen, darkred, brown, blue, red, \
import entropy.tools
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands.install import SoloInstall
from solo.utils import print_table
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.install import SoloInstall
from _entropy.solo.utils import print_table
class SoloSecurity(SoloInstall):
+2 -2
View File
@@ -16,8 +16,8 @@ import argparse
from entropy.i18n import _
from entropy.output import darkred, darkgreen, blue
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands._manage import SoloManage
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands._manage import SoloManage
class SoloSource(SoloManage):
"""
+2 -2
View File
@@ -19,8 +19,8 @@ from entropy.const import etpConst, const_convert_to_unicode
import entropy.tools
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands.command import SoloCommand
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.command import SoloCommand
class SoloStatus(SoloCommand):
"""
+3 -3
View File
@@ -24,9 +24,9 @@ from entropy.client.services.interfaces import Document, DocumentFactory, \
import entropy.tools
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands.command import SoloCommand
from solo.utils import get_entropy_webservice as _get_service
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.command import SoloCommand
from _entropy.solo.utils import get_entropy_webservice as _get_service
class SoloUgc(SoloCommand):
+2 -2
View File
@@ -20,8 +20,8 @@ from entropy.output import red, blue, brown, darkgreen
import entropy.tools
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands.command import SoloCommand, sharedlock
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.command import SoloCommand, sharedlock
class SoloUnused(SoloCommand):
+2 -2
View File
@@ -22,8 +22,8 @@ from entropy.client.interfaces.noticeboard import NoticeBoard
import entropy.tools
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands.command import SoloCommand
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.command import SoloCommand
class SoloUpdate(SoloCommand):
"""
+3 -3
View File
@@ -20,9 +20,9 @@ from entropy.locks import EntropyResourcesLock
import entropy.tools
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands.install import SoloInstall
from solo.commands.remove import SoloRemove
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.install import SoloInstall
from _entropy.solo.commands.remove import SoloRemove
class SoloUpgrade(SoloInstall, SoloRemove):
+3 -3
View File
@@ -12,10 +12,10 @@
from entropy.i18n import _
from entropy.output import TextInterface
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands.command import SoloCommand
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.command import SoloCommand
from solo.utils import read_client_release
from _entropy.solo.utils import read_client_release
class SoloVersion(SoloCommand):
"""
+2 -2
View File
@@ -15,8 +15,8 @@ from entropy.i18n import _
from entropy.output import TextInterface
from entropy.cache import EntropyCacher
from solo.commands.descriptor import SoloCommandDescriptor
from solo.commands.command import SoloCommand
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.commands.command import SoloCommand
class SoloYell(SoloCommand):
"""
+2 -2
View File
@@ -25,8 +25,8 @@ from entropy.exceptions import SystemDatabaseError, OnlineMirrorError, \
import entropy.tools
from solo.commands.descriptor import SoloCommandDescriptor
from solo.utils import read_client_release
from _entropy.solo.commands.descriptor import SoloCommandDescriptor
from _entropy.solo.utils import read_client_release
def handle_exception(exc_class, exc_instance, exc_tb):
@@ -0,0 +1,4 @@
import sys
import solo
sys.modules['_entropy.solo'] = solo
+2 -1
View File
@@ -31,7 +31,8 @@ def add_import_path(mod):
mods = (
"client",
"server",
"lib"
"lib",
"entropy_path_loader/compat"
)
for mod in mods:
+1 -1
View File
@@ -308,7 +308,7 @@ else:
# this test might be considered controversial, for now, let's keep it
# here, we use equo stuff to make sure it keeps working
from solo.commands.pkg import SoloPkg
from _entropy.solo.commands.pkg import SoloPkg
# we need to tweak the default unpack dir to make pkg install available
# for uids != 0