mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-27 17:44:42 +00:00
Deprecate the --priority option.
This commit is contained in:
parent
0635f7126d
commit
a493a3ded1
7 changed files with 380 additions and 455 deletions
|
|
@ -14,6 +14,7 @@ Fixes:
|
|||
Changes:
|
||||
- gui: Use Alt-key shortcuts for menu entries.
|
||||
- checking: Improved thread locking and reduce calls to time.sleep().
|
||||
- cmdline: Deprecated the --priority commandline option.
|
||||
|
||||
Features:
|
||||
- checking: Added support for Google Chrome bookmark files.
|
||||
|
|
|
|||
|
|
@ -68,10 +68,6 @@ Generiere nicht mehr als die angegebene Anzahl von Threads. Standard Anzahl
|
|||
von Threads ist 10. Um Threads zu deaktivieren, geben Sie eine nicht
|
||||
positive Nummer an.
|
||||
.TP
|
||||
\fB\-\-priority\fP
|
||||
Starte mit normaler Threadpriorität. Als Standard läuft LinkChecker mit
|
||||
niedriger Threadpriorität, um als Hintergrundprozess geeignet zu sein.
|
||||
.TP
|
||||
\fB\-V\fP, \fB\-\-version\fP
|
||||
Gebe die Version aus und beende das Programm.
|
||||
.TP
|
||||
|
|
|
|||
|
|
@ -67,10 +67,6 @@ Ask for URL if none are given on the commandline.
|
|||
Generate no more than the given number of threads. Default number
|
||||
of threads is 10. To disable threading specify a non-positive number.
|
||||
.TP
|
||||
\fB\-\-priority\fP
|
||||
Run with normal thread scheduling priority. Per default LinkChecker runs
|
||||
with low thread priority to be suitable as a background job.
|
||||
.TP
|
||||
\fB\-V\fP, \fB\-\-version\fP
|
||||
Print version and exit.
|
||||
.TP
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -17,52 +17,7 @@
|
|||
"""
|
||||
Support for managing threads.
|
||||
"""
|
||||
|
||||
import os
|
||||
import threading
|
||||
try:
|
||||
import win32process
|
||||
has_win32process = True
|
||||
except ImportError:
|
||||
has_win32process = False
|
||||
from .containers import enum
|
||||
|
||||
# generic thread priorities with mappings to Windows and Unix
|
||||
# priority values
|
||||
Prio = enum("high", "normal", "low")
|
||||
|
||||
_posix_nice_val = {
|
||||
Prio.high: -5,
|
||||
Prio.normal: +0,
|
||||
Prio.low: +10,
|
||||
}
|
||||
if has_win32process:
|
||||
if hasattr(win32process, "BELOW_NORMAL_PRIORITY_CLASS"):
|
||||
low = win32process.BELOW_NORMAL_PRIORITY_CLASS
|
||||
else:
|
||||
low = win32process.IDLE_PRIORITY_CLASS
|
||||
if hasattr(win32process, "ABOVE_NORMAL_PRIORITY_CLASS"):
|
||||
high = win32process.ABOVE_NORMAL_PRIORITY_CLASS
|
||||
else:
|
||||
high = win32process.HIGH_PRIORITY_CLASS
|
||||
_nt_prio_val = {
|
||||
Prio.high: high,
|
||||
Prio.normal: win32process.NORMAL_PRIORITY_CLASS,
|
||||
Prio.low: low,
|
||||
}
|
||||
del low, high
|
||||
|
||||
|
||||
def set_thread_priority (prio):
|
||||
"""Set priority of this thread (and thus also for all spawned threads)."""
|
||||
if os.name == 'nt' and has_win32process:
|
||||
res = win32process.SetPriorityClass(
|
||||
win32process.GetCurrentProcess(), _nt_prio_val[prio])
|
||||
elif os.name == 'posix':
|
||||
res = os.nice(_posix_nice_val[prio])
|
||||
else:
|
||||
res = None
|
||||
return res
|
||||
|
||||
|
||||
class StoppableThread (threading.Thread):
|
||||
|
|
|
|||
|
|
@ -345,9 +345,7 @@ group.add_option("-t", "--threads", type="int", dest="threads",
|
|||
"""Generate no more than the given number of threads. Default number
|
||||
of threads is 10. To disable threading specify a non-positive number."""))
|
||||
group.add_option("--priority", action="store_true", dest="priority",
|
||||
help=_(
|
||||
"""Run with normal thread scheduling priority. Per default LinkChecker
|
||||
runs with low thread priority to be suitable as a background job."""))
|
||||
help=_("""This option is deprecated and does nothing."""))
|
||||
group.add_option("-V", "--version", action="store_true", dest="version",
|
||||
help=_("""Print version and exit."""))
|
||||
group.add_option("--allow-root", action="store_true", dest="allowroot",
|
||||
|
|
@ -598,9 +596,6 @@ if options.debug and not __debug__:
|
|||
# apply commandline options and arguments to configuration
|
||||
constructauth = False
|
||||
do_profile = False
|
||||
if not options.priority:
|
||||
import linkcheck.threader
|
||||
linkcheck.threader.set_thread_priority(linkcheck.threader.Prio.low)
|
||||
if options.warnings is not None:
|
||||
config["warnings"] = options.warnings
|
||||
if options.anchors is not None:
|
||||
|
|
|
|||
Loading…
Reference in a new issue