Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.libnetworkcache
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
slapos.libnetworkcache
Commits
fc3169ee
Commit
fc3169ee
authored
Sep 26, 2024
by
Thomas Gambier
🚴🏼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove python2 support
Remove also old init version
parent
510deb64
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
48 deletions
+11
-48
setup.py
setup.py
+1
-2
slapos/libnetworkcache.py
slapos/libnetworkcache.py
+7
-38
slapos/libnetworkcachetests.py
slapos/libnetworkcachetests.py
+3
-8
No files found.
setup.py
View file @
fc3169ee
...
...
@@ -37,7 +37,6 @@ setup(
classifiers
=
[
'Development Status :: 4 - Beta'
,
'License :: OSI Approved :: GNU General Public License (GPL)'
,
'Programming Language :: Python :: 2.7'
,
'Programming Language :: Python :: 3'
,
'Programming Language :: Python :: 3.7'
,
'Programming Language :: Python :: 3.8'
,
...
...
@@ -46,7 +45,7 @@ setup(
'Programming Language :: Python :: 3.11'
,
'Programming Language :: Python :: 3.12'
,
],
python_requires
=
">=
2
.7"
,
python_requires
=
">=
3
.7"
,
entry_points
=
{
'console_scripts'
:
[
'generate-signature-key = slapos.signature:run'
,
...
...
slapos/libnetworkcache.py
View file @
fc3169ee
...
...
@@ -27,19 +27,12 @@ import tarfile
import
tempfile
import
traceback
from
base64
import
b64encode
,
b64decode
try
:
from
configparser
import
ConfigParser
from
http.client
import
HTTPConnection
,
HTTPSConnection
from
urllib.error
import
HTTPError
from
urllib.parse
import
urlsplit
from
urllib.request
import
urlopen
basestring
=
bytes
,
str
except
ImportError
:
from
ConfigParser
import
SafeConfigParser
as
ConfigParser
ConfigParser
.
read_file
=
ConfigParser
.
readfp
from
httplib
import
HTTPConnection
,
HTTPSConnection
from
urllib2
import
HTTPError
,
urlopen
from
urlparse
import
urlsplit
from
configparser
import
ConfigParser
from
http.client
import
HTTPConnection
,
HTTPSConnection
from
urllib.error
import
HTTPError
from
urllib.parse
import
urlsplit
from
urllib.request
import
urlopen
basestring
=
bytes
,
str
try
:
from
OpenSSL
import
crypto
except
ImportError
:
...
...
@@ -171,32 +164,8 @@ class NetworkcacheClient(object):
'''
signature_private_key
=
None
def
__init__
(
self
,
*
args
,
**
kw
):
def
__init__
(
self
,
config
,
signature_certificate_list
=
None
):
"""Initializes shacache object"""
if
isinstance
(
args
[
0
],
basestring
)
if
args
else
'config'
not
in
kw
:
self
.
__old_init
(
*
args
,
**
kw
)
# BBB
else
:
self
.
__new_init
(
*
args
,
**
kw
)
def
__old_init
(
self
,
shacache
,
shadir
,
signature_private_key_file
=
None
,
signature_certificate_list
=
None
,
shacache_ca_file
=
None
,
shacache_key_file
=
None
,
shacache_cert_file
=
None
,
shadir_ca_file
=
None
,
shadir_key_file
=
None
,
shadir_cert_file
=
None
):
self
.
__new_init
({
'signature-private-key-file'
:
signature_private_key_file
,
'download-cache-url'
:
shacache
,
'upload-cache-url'
:
shacache
,
'shacache-ca-file'
:
shacache_ca_file
,
'shacache-cert-file'
:
shacache_cert_file
,
'shacache-key-file'
:
shacache_key_file
,
'download-dir-url'
:
shadir
,
'upload-dir-url'
:
shadir
,
'shadir-ca-file'
:
shadir_ca_file
,
'shadir-cert-file'
:
shadir_cert_file
,
'shadir-key-file'
:
shadir_key_file
,
},
signature_certificate_list
)
def
__new_init
(
self
,
config
,
signature_certificate_list
=
None
):
if
not
hasattr
(
config
,
'get'
):
parser
=
ConfigParser
()
parser
.
read_file
(
config
)
...
...
slapos/libnetworkcachetests.py
View file @
fc3169ee
...
...
@@ -18,14 +18,9 @@ import slapos.libnetworkcache
import
slapos.signature
import
sys
from
io
import
BytesIO
try
:
from
http.server
import
BaseHTTPRequestHandler
,
HTTPServer
from
http.client
import
HTTPConnection
,
NOT_FOUND
from
urllib.error
import
HTTPError
except
ImportError
:
from
BaseHTTPServer
import
BaseHTTPRequestHandler
,
HTTPServer
from
httplib
import
HTTPConnection
,
NOT_FOUND
from
urllib2
import
HTTPError
from
http.server
import
BaseHTTPRequestHandler
,
HTTPServer
from
http.client
import
HTTPConnection
,
NOT_FOUND
from
urllib.error
import
HTTPError
logging
.
basicConfig
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment