mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-02 23:55:27 +00:00
[master] enable windows python tools
3757. [port] Enable Python tools (dnssec-coverage, dnssec-checkds) to run on Windows. [RT #34355]
This commit is contained in:
@@ -15,15 +15,41 @@
|
||||
# PERFORMANCE OF THIS SOFTWARE.
|
||||
############################################################################
|
||||
|
||||
# $Id$
|
||||
|
||||
import argparse
|
||||
import pprint
|
||||
import os
|
||||
|
||||
prog='dnssec-checkds'
|
||||
|
||||
# These routines permit platform-independent location of BIND 9 tools
|
||||
if os.name == 'nt':
|
||||
import win32con
|
||||
import win32api
|
||||
|
||||
def prefix(bindir = ''):
|
||||
if os.name != 'nt':
|
||||
return os.path.join('@prefix@', bindir)
|
||||
|
||||
bind_subkey = "Software\\ISC\\BIND"
|
||||
hKey = None
|
||||
keyFound = True
|
||||
try:
|
||||
hKey = win32api.RegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE, bind_subkey)
|
||||
except:
|
||||
keyFound = False
|
||||
if keyFound:
|
||||
try:
|
||||
(namedBase, _) = win32api.RegQueryValueEx(hKey, "InstallDir")
|
||||
except:
|
||||
keyFound = False
|
||||
win32api.RegCloseKey(hKey)
|
||||
if keyFound:
|
||||
return os.path.join(namedBase, bindir)
|
||||
return os.path.join(win32api.GetSystemDirectory(), bindir)
|
||||
|
||||
def shellquote(s):
|
||||
if os.name == 'nt':
|
||||
return s
|
||||
return '"' + s.replace('"', '"\\"') + '"'
|
||||
return "'" + s.replace("'", "'\\''") + "'"
|
||||
|
||||
############################################################################
|
||||
@@ -257,12 +283,13 @@ def checkdlv(zone, lookaside, masterfile = None):
|
||||
############################################################################
|
||||
def parse_args():
|
||||
global args
|
||||
parser = argparse.ArgumentParser(description=prog + ': checks DS coverage')
|
||||
|
||||
bindir = 'bin'
|
||||
if os.name != 'nt':
|
||||
sbindir = 'sbin'
|
||||
else:
|
||||
if os.name == 'nt':
|
||||
sbindir = 'bin'
|
||||
parser = argparse.ArgumentParser(description='checkds: checks DS coverage')
|
||||
else:
|
||||
sbindir = 'sbin'
|
||||
|
||||
parser.add_argument('zone', type=str, help='zone to check')
|
||||
parser.add_argument('-f', '--file', dest='masterfile', type=str,
|
||||
@@ -270,10 +297,10 @@ def parse_args():
|
||||
parser.add_argument('-l', '--lookaside', dest='lookaside', type=str,
|
||||
help='DLV lookaside zone')
|
||||
parser.add_argument('-d', '--dig', dest='dig',
|
||||
default=os.path.join('@prefix@', bindir, 'dig'),
|
||||
default=os.path.join(prefix(bindir), 'dig'),
|
||||
type=str, help='path to \'dig\'')
|
||||
parser.add_argument('-D', '--dsfromkey', dest='dsfromkey',
|
||||
default=os.path.join('@prefix@', sbindir,
|
||||
default=os.path.join(prefix(sbindir),
|
||||
'dnssec-dsfromkey'),
|
||||
type=str, help='path to \'dig\'')
|
||||
parser.add_argument('-v', '--version', action='version', version='9.9.1')
|
||||
|
Reference in New Issue
Block a user