pyreposync 0.2.5__py3-none-any.whl → 0.2.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pyreposync/__init__.py CHANGED
@@ -10,7 +10,7 @@ import time
10
10
  from pyreposync.downloader import Downloader
11
11
  from pyreposync.exceptions import OSRepoSyncException, OSRepoSyncHashError
12
12
  from pyreposync.sync_rpm import SyncRPM
13
- from pyreposync.sync_deb import SyncDeb
13
+ from pyreposync.sync_deb822 import SyncDeb822
14
14
 
15
15
 
16
16
  def main():
@@ -269,20 +269,32 @@ class PyRepoSync:
269
269
  section, "allow_missing_packages", fallback=False
270
270
  ),
271
271
  treeinfo=self.config.get(section, "treeinfo", fallback=".treeinfo"),
272
+ basic_auth_user=self.config.get(
273
+ section, "basic_auth_user", fallback=None
274
+ ),
275
+ basic_auth_pass=self.config.get(
276
+ section, "basic_auth_pass", fallback=None
277
+ ),
272
278
  proxy=self.config.get("main", "proxy", fallback=None),
273
279
  client_cert=self.config.get(section, "sslclientcert", fallback=None),
274
280
  client_key=self.config.get(section, "sslclientkey", fallback=None),
275
281
  ca_cert=self.config.get(section, "sslcacert", fallback=None),
276
282
  )
277
- elif section.endswith(":deb"):
278
- return SyncDeb(
283
+ elif section.endswith(":deb822"):
284
+ return SyncDeb822(
279
285
  base_url=self.config.get(section, "baseurl"),
280
286
  destination=self.config.get("main", "destination"),
281
- reponame=section[:-4],
287
+ reponame=section[:-7],
282
288
  date=date,
283
289
  allow_missing_packages=self.config.getboolean(
284
290
  section, "allow_missing_packages", fallback=False
285
291
  ),
292
+ basic_auth_user=self.config.get(
293
+ section, "basic_auth_user", fallback=None
294
+ ),
295
+ basic_auth_pass=self.config.get(
296
+ section, "basic_auth_pass", fallback=None
297
+ ),
286
298
  proxy=self.config.get(section, "proxy", fallback=None),
287
299
  client_cert=self.config.get(section, "sslclientcert", fallback=None),
288
300
  client_key=self.config.get(section, "sslclientkey", fallback=None),
@@ -291,11 +303,12 @@ class PyRepoSync:
291
303
  components=self.config.get(section, "components").split(),
292
304
  binary_archs=self.config.get(section, "binary_archs").split(),
293
305
  )
306
+ return None
294
307
 
295
308
  def get_sections(self):
296
309
  sections = set()
297
310
  for section in self.config:
298
- if section.endswith(":rpm") or section.endswith(":deb"):
311
+ if section.endswith(":rpm") or section.endswith(":deb822"):
299
312
  if self.repo and section != self.repo:
300
313
  continue
301
314
  if self._tags:
pyreposync/downloader.py CHANGED
@@ -2,6 +2,7 @@ import hashlib
2
2
  import logging
3
3
  import os
4
4
  import requests
5
+ import requests.auth
5
6
  import requests.exceptions
6
7
  import shutil
7
8
  import tempfile
@@ -11,8 +12,20 @@ from pyreposync.exceptions import OSRepoSyncDownLoadError, OSRepoSyncHashError
11
12
 
12
13
 
13
14
  class Downloader(object):
14
- def __init__(self, proxy=None, client_cert=None, client_key=None, ca_cert=None):
15
+ def __init__(
16
+ self,
17
+ basic_auth_user=None,
18
+ basic_auth_pass=None,
19
+ proxy=None,
20
+ client_cert=None,
21
+ client_key=None,
22
+ ca_cert=None,
23
+ ):
15
24
  self.log = logging.getLogger("application")
25
+ if basic_auth_user and basic_auth_pass:
26
+ self._basic_auth = (basic_auth_user, basic_auth_pass)
27
+ else:
28
+ self._basic_auth = None
16
29
  if proxy:
17
30
  self._proxy = {"http": proxy, "https": proxy}
18
31
  else:
@@ -26,6 +39,10 @@ class Downloader(object):
26
39
  else:
27
40
  self._ca_cert = True
28
41
 
42
+ @property
43
+ def basic_auth(self):
44
+ return self._basic_auth
45
+
29
46
  @property
30
47
  def ca_cert(self):
31
48
  return self._ca_cert
@@ -123,7 +140,12 @@ class Downloader(object):
123
140
  ):
124
141
  self.create_dir(destination)
125
142
  r = requests.get(
126
- url, stream=True, proxies=self.proxy, cert=self.cert, verify=self.ca_cert
143
+ url,
144
+ auth=self.basic_auth,
145
+ stream=True,
146
+ proxies=self.proxy,
147
+ cert=self.cert,
148
+ verify=self.ca_cert,
127
149
  )
128
150
  if r.status_code == 200:
129
151
  with open(destination, "wb", 0) as dst:
@@ -6,7 +6,7 @@ import os
6
6
  from pyreposync.sync_generic import SyncGeneric
7
7
 
8
8
 
9
- class SyncDeb(SyncGeneric):
9
+ class SyncDeb822(SyncGeneric):
10
10
  def __init__(
11
11
  self,
12
12
  base_url,
@@ -17,6 +17,8 @@ class SyncDeb(SyncGeneric):
17
17
  components,
18
18
  binary_archs,
19
19
  allow_missing_packages,
20
+ basic_auth_user=None,
21
+ basic_auth_pass=None,
20
22
  proxy=None,
21
23
  client_cert=None,
22
24
  client_key=None,
@@ -28,6 +30,8 @@ class SyncDeb(SyncGeneric):
28
30
  reponame=reponame,
29
31
  date=date,
30
32
  allow_missing_packages=allow_missing_packages,
33
+ basic_auth_user=basic_auth_user,
34
+ basic_auth_pass=basic_auth_pass,
31
35
  proxy=proxy,
32
36
  client_cert=client_cert,
33
37
  client_key=client_key,
@@ -14,6 +14,8 @@ class SyncGeneric:
14
14
  reponame,
15
15
  date,
16
16
  allow_missing_packages,
17
+ basic_auth_user=None,
18
+ basic_auth_pass=None,
17
19
  proxy=None,
18
20
  client_cert=None,
19
21
  client_key=None,
@@ -25,7 +27,12 @@ class SyncGeneric:
25
27
  self._destination = destination
26
28
  self._reponame = reponame
27
29
  self.downloader = Downloader(
28
- proxy=proxy, client_cert=client_cert, client_key=client_key, ca_cert=ca_cert
30
+ basic_auth_user=basic_auth_user,
31
+ basic_auth_pass=basic_auth_pass,
32
+ proxy=proxy,
33
+ client_cert=client_cert,
34
+ client_key=client_key,
35
+ ca_cert=ca_cert,
29
36
  )
30
37
  self.log = logging.getLogger("application")
31
38
 
pyreposync/sync_rpm.py CHANGED
@@ -24,6 +24,8 @@ class SyncRPM(SyncGeneric):
24
24
  date,
25
25
  treeinfo,
26
26
  allow_missing_packages,
27
+ basic_auth_user=None,
28
+ basic_auth_pass=None,
27
29
  proxy=None,
28
30
  client_cert=None,
29
31
  client_key=None,
@@ -35,6 +37,8 @@ class SyncRPM(SyncGeneric):
35
37
  reponame=reponame,
36
38
  date=date,
37
39
  allow_missing_packages=allow_missing_packages,
40
+ basic_auth_user=basic_auth_user,
41
+ basic_auth_pass=basic_auth_pass,
38
42
  proxy=proxy,
39
43
  client_cert=client_cert,
40
44
  client_key=client_key,
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyreposync
3
- Version: 0.2.5
4
- Summary: Orbit Api
3
+ Version: 0.2.7
4
+ Summary: rpm and deb822 repository sync tool
5
5
  Project-URL: Source, https://github.com/schlitzered/pyreposync
6
6
  Author-email: "Stephan.Schultchen" <sschultchen@gmail.com>
7
7
  License: The MIT License (MIT)
@@ -0,0 +1,11 @@
1
+ pyreposync/__init__.py,sha256=fHirsBBkEk806RJwVKQZHgujQZRk13YnokX-8rp_QJE,17117
2
+ pyreposync/downloader.py,sha256=cRUtbQ4PYbGDczZl5PsBtTQFhqagnX9IQvbwSCd0OBc,5212
3
+ pyreposync/exceptions.py,sha256=IlnvhNaffQQ6geOgrjCciNFVbFpNcycH4ijSuMTbrGA,169
4
+ pyreposync/sync_deb822.py,sha256=Ynwok1fiZktO3P_0lYWfBOHgaJOFpzfVNkhgKL5Y56s,8517
5
+ pyreposync/sync_generic.py,sha256=qe-ERp8O2kCnhOuToSZWhdQzGY7aYb7G7nUxuKD3lxY,5880
6
+ pyreposync/sync_rpm.py,sha256=FXWEJd2YelMsZeTOnjcNjkN2D_ECtX9HEp73GpiLeK4,11763
7
+ pyreposync-0.2.7.dist-info/METADATA,sha256=t_2vG9j5arm-bG1SyZ0DDqADLwQKEiqS66EZ-q1VnJE,1591
8
+ pyreposync-0.2.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
+ pyreposync-0.2.7.dist-info/entry_points.txt,sha256=9LsBDWOF3O6_3ONP3Lc-4v1MTt5ay0Xv-TMcFbOIt2s,47
10
+ pyreposync-0.2.7.dist-info/licenses/LICENSE.txt,sha256=lwnJoIo7uwc0h6y6gC_RYqJkvjplViV3Ad6u7pQM4Bw,1084
11
+ pyreposync-0.2.7.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- pyreposync/__init__.py,sha256=Y5wux97cZGbZfLJa2aXku1ZwISLVqoeYsgDDVTmbVpU,16562
2
- pyreposync/downloader.py,sha256=828bIMCctd1X6I1w91-XHytQ1M5fmxkEw0YDKd5nvAY,4764
3
- pyreposync/exceptions.py,sha256=IlnvhNaffQQ6geOgrjCciNFVbFpNcycH4ijSuMTbrGA,169
4
- pyreposync/sync_deb.py,sha256=d9UggP-wW5CXXV4bjmd0gk7i0BM9xDeEJP8XEY_tYN0,8364
5
- pyreposync/sync_generic.py,sha256=wN5hPcIacvQiMQoajcf7WSbiBGqxI86CYwfVnq1fR38,5693
6
- pyreposync/sync_rpm.py,sha256=1yf2-lQShKyY3CI_FW1i0tyWQ0sg69iBUn-4iWfoevk,11613
7
- pyreposync-0.2.5.dist-info/METADATA,sha256=Vs779KRX_64pvfPldLU6yQvLvdk0w3xIPxMEUfUlKbQ,1565
8
- pyreposync-0.2.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
- pyreposync-0.2.5.dist-info/entry_points.txt,sha256=9LsBDWOF3O6_3ONP3Lc-4v1MTt5ay0Xv-TMcFbOIt2s,47
10
- pyreposync-0.2.5.dist-info/licenses/LICENSE.txt,sha256=lwnJoIo7uwc0h6y6gC_RYqJkvjplViV3Ad6u7pQM4Bw,1084
11
- pyreposync-0.2.5.dist-info/RECORD,,