-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to pyproject.toml based build system.
- Loading branch information
1 parent
662230c
commit 5f81bf1
Showing
20 changed files
with
113 additions
and
310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
include MANIFEST.in HISTORY.rst LICENSE.txt AUTHORS.rst | ||
include HISTORY.rst | ||
include doc/Makefile doc/*.rst doc/*.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env python | ||
#!/usr/bin/env python3 | ||
|
||
# | ||
# Copyright (c) 2015 Palo Alto Networks, Inc. <[email protected]> | ||
|
@@ -16,7 +16,6 @@ | |
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
# | ||
|
||
from __future__ import print_function | ||
import datetime | ||
import getopt | ||
import json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env python | ||
#!/usr/bin/env python3 | ||
|
||
# | ||
# Copyright (c) 2012-2014 Kevin Steves <[email protected]> | ||
|
@@ -16,7 +16,6 @@ | |
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
# | ||
|
||
from __future__ import print_function | ||
import sys | ||
import os | ||
import signal | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env python | ||
#!/usr/bin/env python3 | ||
|
||
# | ||
# Copyright (c) 2017 Palo Alto Networks, Inc. <[email protected]> | ||
|
@@ -16,7 +16,6 @@ | |
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
# | ||
|
||
from __future__ import print_function | ||
import getopt | ||
import json | ||
import logging | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env python | ||
#!/usr/bin/env python3 | ||
|
||
# | ||
# Copyright (c) 2013-2017 Kevin Steves <[email protected]> | ||
|
@@ -16,7 +16,6 @@ | |
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
# | ||
|
||
from __future__ import print_function | ||
from datetime import date, timedelta | ||
import sys | ||
import os | ||
|
@@ -26,10 +25,7 @@ | |
import pprint | ||
import logging | ||
import ssl | ||
try: | ||
from urllib.parse import urlparse | ||
except ImportError: | ||
from urlparse import urlparse | ||
from urllib.parse import urlparse | ||
|
||
libpath = os.path.dirname(os.path.abspath(__file__)) | ||
sys.path[:0] = [os.path.join(libpath, os.pardir, 'lib')] | ||
|
@@ -474,33 +470,26 @@ def parse_opts(): | |
|
||
|
||
def create_ssl_context(cafile, capath, ssl_option): | ||
# PEP 0476 | ||
if (sys.version_info.major == 2 and sys.hexversion >= 0x02070900 or | ||
sys.version_info.major == 3 and sys.hexversion >= 0x03040300): | ||
if cafile or capath: | ||
try: | ||
ssl_context = ssl.create_default_context( | ||
purpose=ssl.Purpose.SERVER_AUTH, | ||
cafile=cafile, | ||
capath=capath) | ||
except Exception as e: | ||
print('cafile or capath invalid: %s' % e, file=sys.stderr) | ||
sys.exit(1) | ||
elif ssl_option: | ||
if ssl_option == 'cacloud': | ||
ssl_context = pan.wfapi.cloud_ssl_context() | ||
elif ssl_option == 'noverify': | ||
ssl_context = ssl._create_unverified_context() | ||
elif ssl_option == 'default': | ||
ssl_context = None | ||
|
||
return ssl_context | ||
|
||
print('Warning: Python %d.%d.%d: cafile, capath and ssl ignored' % | ||
(sys.version_info.major, sys.version_info.minor, | ||
sys.version_info.micro), file=sys.stderr) | ||
if cafile or capath: | ||
try: | ||
ssl_context = ssl.create_default_context( | ||
purpose=ssl.Purpose.SERVER_AUTH, | ||
cafile=cafile, | ||
capath=capath) | ||
except Exception as e: | ||
print('cafile or capath invalid: %s' % e, file=sys.stderr) | ||
sys.exit(1) | ||
elif ssl_option: | ||
if ssl_option == 'cacloud': | ||
ssl_context = pan.wfapi.cloud_ssl_context() | ||
elif ssl_option == 'noverify': | ||
ssl_context = ssl._create_unverified_context() | ||
elif ssl_option == 'default': | ||
ssl_context = None | ||
else: | ||
assert False, 'cafile or capath or ssl_option' | ||
|
||
return None | ||
return ssl_context | ||
|
||
|
||
def print_status(wfapi, action, exception_msg=None): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env python | ||
#!/usr/bin/env python3 | ||
|
||
# | ||
# Copyright (c) 2013-2015 Kevin Steves <[email protected]> | ||
|
@@ -16,7 +16,6 @@ | |
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
# | ||
|
||
from __future__ import print_function | ||
from datetime import datetime | ||
import sys | ||
import os | ||
|
@@ -610,28 +609,18 @@ def parse_opts(): | |
|
||
|
||
def create_ssl_context(cafile, capath): | ||
if (sys.version_info.major == 2 and sys.hexversion >= 0x02070900 or | ||
sys.version_info.major == 3 and sys.hexversion >= 0x03020000): | ||
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) | ||
context.options |= ssl.OP_NO_SSLv2 | ||
context.options |= ssl.OP_NO_SSLv3 | ||
context.verify_mode = ssl.CERT_REQUIRED | ||
# added 3.4 | ||
if hasattr(context, 'check_hostname'): | ||
context.check_hostname = True | ||
try: | ||
context.load_verify_locations(cafile=cafile, capath=capath) | ||
except Exception as e: | ||
print('cafile or capath invalid: %s' % e, file=sys.stderr) | ||
sys.exit(1) | ||
|
||
return context | ||
|
||
print('Warning: Python %d.%d: cafile and capath ignored' % | ||
(sys.version_info.major, sys.version_info.minor), | ||
file=sys.stderr) | ||
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) | ||
context.options |= ssl.OP_NO_SSLv2 | ||
context.options |= ssl.OP_NO_SSLv3 | ||
context.verify_mode = ssl.CERT_REQUIRED | ||
context.check_hostname = True | ||
try: | ||
context.load_verify_locations(cafile=cafile, capath=capath) | ||
except Exception as e: | ||
print('cafile or capath invalid: %s' % e, file=sys.stderr) | ||
sys.exit(1) | ||
|
||
return None | ||
return context | ||
|
||
|
||
def get_vsys(s): | ||
|
@@ -828,23 +817,14 @@ def set_encoding(): | |
# | ||
encoding = 'utf-8' | ||
|
||
if hasattr(sys.stdin, 'detach'): | ||
# >= 3.1 | ||
import io | ||
|
||
for s in ('stdin', 'stdout', 'stderr'): | ||
line_buffering = getattr(sys, s).line_buffering | ||
# print(s, line_buffering, file=sys.stderr) | ||
setattr(sys, s, io.TextIOWrapper(getattr(sys, s).detach(), | ||
encoding=encoding, | ||
line_buffering=line_buffering)) | ||
|
||
else: | ||
import codecs | ||
import io | ||
|
||
sys.stdin = codecs.getreader(encoding)(sys.stdin) | ||
sys.stdout = codecs.getwriter(encoding)(sys.stdout) | ||
sys.stderr = codecs.getwriter(encoding)(sys.stderr) | ||
for s in ('stdin', 'stdout', 'stderr'): | ||
line_buffering = getattr(sys, s).line_buffering | ||
# print(s, line_buffering, file=sys.stderr) | ||
setattr(sys, s, io.TextIOWrapper(getattr(sys, s).detach(), | ||
encoding=encoding, | ||
line_buffering=line_buffering)) | ||
|
||
|
||
def usage(): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.