Browse Source

Move apireg to utils directory

pull/1426/head
Safihre 5 years ago
parent
commit
adcb690662
  1. 2
      .travis.yml
  2. 2
      SABnzbd.py
  3. 1
      appveyor.yml
  4. 6
      sabnzbd/__init__.py
  5. 15
      sabnzbd/interface.py
  6. 0
      sabnzbd/utils/apireg.py
  7. 2
      tests/test_win_utils.py
  8. 0
      util/__init__.py

2
.travis.yml

@ -43,6 +43,7 @@ install:
fi; fi;
- python3 --version - python3 --version
- python3 -m pip install --upgrade pip - python3 -m pip install --upgrade pip
- python3 -m pip install --upgrade wheel
- python3 -m pip install --upgrade -r requirements.txt - python3 -m pip install --upgrade -r requirements.txt
- python3 -m pip install --upgrade -r tests/requirements.txt - python3 -m pip install --upgrade -r tests/requirements.txt
@ -55,7 +56,6 @@ script:
scripts scripts
tools tools
tests tests
util
sabnzbd/utils sabnzbd/utils
sabnzbd/__init__.py sabnzbd/__init__.py
sabnzbd/cfg.py sabnzbd/cfg.py

2
SABnzbd.py

@ -79,7 +79,7 @@ try:
import win32ts import win32ts
import pywintypes import pywintypes
win32api.SetConsoleCtrlHandler(sabnzbd.sig_handler, True) win32api.SetConsoleCtrlHandler(sabnzbd.sig_handler, True)
from util.apireg import get_connection_info, set_connection_info, del_connection_info from sabnzbd.utils.apireg import get_connection_info, set_connection_info, del_connection_info
except ImportError: except ImportError:
if sabnzbd.WIN32: if sabnzbd.WIN32:
print("Sorry, requires Python module PyWin32.") print("Sorry, requires Python module PyWin32.")

1
appveyor.yml

@ -17,6 +17,7 @@ install:
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
- python --version - python --version
- python -m pip install --upgrade pip - python -m pip install --upgrade pip
- python -m pip install --upgrade wheel
- python -m pip install --upgrade -r requirements.txt - python -m pip install --upgrade -r requirements.txt
- python -m pip install --upgrade -r tests/requirements.txt - python -m pip install --upgrade -r tests/requirements.txt

6
sabnzbd/__init__.py

@ -41,7 +41,7 @@ KERNEL32 = None
if os.name == "nt": if os.name == "nt":
WIN32 = True WIN32 = True
from util.apireg import del_connection_info from sabnzbd.utils.apireg import del_connection_info
try: try:
import ctypes import ctypes
@ -168,7 +168,7 @@ COMPLETE_DIR_SPEED = 0
INTERNET_BANDWIDTH = 0 INTERNET_BANDWIDTH = 0
# Rendering of original command line arguments in Config # Rendering of original command line arguments in Config
CMDLINE = " ".join(["\"%s\"" % arg for arg in sys.argv]) CMDLINE = " ".join(['"%s"' % arg for arg in sys.argv])
__INITIALIZED__ = False __INITIALIZED__ = False
__SHUTTING_DOWN__ = False __SHUTTING_DOWN__ = False
@ -189,8 +189,6 @@ def sig_handler(signum=None, frame=None):
sabnzbd.zconfig.remove_server() sabnzbd.zconfig.remove_server()
finally: finally:
if sabnzbd.WIN32: if sabnzbd.WIN32:
from util.apireg import del_connection_info
del_connection_info() del_connection_info()
if sabnzbd.WINTRAY: if sabnzbd.WINTRAY:
sabnzbd.WINTRAY.terminate = True sabnzbd.WINTRAY.terminate = True

15
sabnzbd/interface.py

@ -25,7 +25,6 @@ from datetime import datetime
import cherrypy import cherrypy
import logging import logging
import urllib.request, urllib.parse, urllib.error import urllib.request, urllib.parse, urllib.error
import json
import re import re
import hashlib import hashlib
import socket import socket
@ -59,17 +58,15 @@ from sabnzbd.utils.diskspeed import diskspeedmeasure
from sabnzbd.utils.getperformance import getpystone from sabnzbd.utils.getperformance import getpystone
from sabnzbd.utils.internetspeed import internetspeed from sabnzbd.utils.internetspeed import internetspeed
from sabnzbd.constants import NORMAL_PRIORITY, MEBI, DEF_SKIN_COLORS, \ from sabnzbd.constants import MEBI, DEF_SKIN_COLORS, \
DEF_STDCONFIG, DEF_MAIN_TMPL, DEFAULT_PRIORITY, CHEETAH_DIRECTIVES DEF_STDCONFIG, DEF_MAIN_TMPL, DEFAULT_PRIORITY, CHEETAH_DIRECTIVES
from sabnzbd.lang import list_languages from sabnzbd.lang import list_languages
from sabnzbd.api import list_scripts, list_cats, del_from_section, \ from sabnzbd.api import list_scripts, list_cats, del_from_section, \
api_handler, build_queue, build_status, \ api_handler, build_queue, build_status, retry_job, retry_all_jobs, \
retry_job, retry_all_jobs, build_header, build_history, del_job_files, \ build_header, build_history, format_bytes, report, del_hist_job, Ttemplate, \
format_bytes, report, del_hist_job, Ttemplate, build_queue_header, \ build_queue_header
_api_test_email, _api_test_notif
############################################################################## ##############################################################################
# Global constants # Global constants
@ -506,8 +503,8 @@ class Wizard:
def index(self, **kwargs): def index(self, **kwargs):
""" Show the language selection page """ """ Show the language selection page """
if sabnzbd.WIN32: if sabnzbd.WIN32:
import util.apireg from sabnzbd.utils.apireg import get_install_lng
cfg.language.set(util.apireg.get_install_lng()) cfg.language.set(get_install_lng())
logging.debug('Installer language code "%s"', cfg.language()) logging.debug('Installer language code "%s"', cfg.language())
info = build_header(sabnzbd.WIZARD_DIR) info = build_header(sabnzbd.WIZARD_DIR)

0
util/apireg.py → sabnzbd/utils/apireg.py

2
tests/test_win_utils.py

@ -25,7 +25,7 @@ import pytest
if not sys.platform.startswith("win"): if not sys.platform.startswith("win"):
pytest.skip("Skipping Windows-only tests", allow_module_level=True) pytest.skip("Skipping Windows-only tests", allow_module_level=True)
import util.apireg as ar import sabnzbd.utils.apireg as ar
class TestAPIReg: class TestAPIReg:

0
util/__init__.py

Loading…
Cancel
Save