Commit 6a6ffbe8 authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

Add support for python3.12

parent a15103a5
Pipeline #37088 passed with stage
in 0 seconds
...@@ -37,8 +37,16 @@ setup( ...@@ -37,8 +37,16 @@ setup(
classifiers=[ classifiers=[
'Development Status :: 4 - Beta', 'Development Status :: 4 - Beta',
'License :: OSI Approved :: GNU General Public License (GPL)', 'License :: OSI Approved :: GNU General Public License (GPL)',
'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
], ],
python_requires=">=2.7",
entry_points={ entry_points={
'console_scripts': [ 'console_scripts': [
'generate-signature-key = slapos.signature:run', 'generate-signature-key = slapos.signature:run',
......
...@@ -28,14 +28,15 @@ import tempfile ...@@ -28,14 +28,15 @@ import tempfile
import traceback import traceback
from base64 import b64encode, b64decode from base64 import b64encode, b64decode
try: try:
import configparser from configparser import ConfigParser
from http.client import HTTPConnection, HTTPSConnection from http.client import HTTPConnection, HTTPSConnection
from urllib.error import HTTPError from urllib.error import HTTPError
from urllib.parse import urlsplit from urllib.parse import urlsplit
from urllib.request import urlopen from urllib.request import urlopen
basestring = bytes, str basestring = bytes, str
except ImportError: except ImportError:
import ConfigParser as configparser from ConfigParser import SafeConfigParser as ConfigParser
ConfigParser.read_file = ConfigParser.readfp
from httplib import HTTPConnection, HTTPSConnection from httplib import HTTPConnection, HTTPSConnection
from urllib2 import HTTPError, urlopen from urllib2 import HTTPError, urlopen
from urlparse import urlsplit from urlparse import urlsplit
...@@ -197,8 +198,8 @@ class NetworkcacheClient(object): ...@@ -197,8 +198,8 @@ class NetworkcacheClient(object):
def __new_init(self, config, signature_certificate_list=None): def __new_init(self, config, signature_certificate_list=None):
if not hasattr(config, 'get'): if not hasattr(config, 'get'):
parser = configparser.SafeConfigParser() parser = ConfigParser()
parser.readfp(config) parser.read_file(config)
config = dict(parser.items('networkcache')) config = dict(parser.items('networkcache'))
self.config = config self.config = config
path = config.get('signature-private-key-file') path = config.get('signature-private-key-file')
......
...@@ -16,10 +16,6 @@ import argparse ...@@ -16,10 +16,6 @@ import argparse
import os import os
import subprocess import subprocess
import sys import sys
try:
import configparser
except ImportError:
import ConfigParser as configparser
def generateCertificate(certificate_file, key_file, common_name): def generateCertificate(certificate_file, key_file, common_name):
if os.path.lexists(certificate_file): if os.path.lexists(certificate_file):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment