ladok3 4.10__tar.gz → 4.11__tar.gz
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.
Potentially problematic release.
This version of ladok3 might be problematic. Click here for more details.
- {ladok3-4.10 → ladok3-4.11}/PKG-INFO +1 -1
- {ladok3-4.10 → ladok3-4.11}/doc/preamble.tex +1 -1
- {ladok3-4.10 → ladok3-4.11}/pyproject.toml +1 -1
- {ladok3-4.10 → ladok3-4.11}/src/ladok3/cli.nw +23 -9
- {ladok3-4.10 → ladok3-4.11}/LICENSE +0 -0
- {ladok3-4.10 → ladok3-4.11}/README.md +0 -0
- {ladok3-4.10 → ladok3-4.11}/doc/Makefile +0 -0
- {ladok3-4.10 → ladok3-4.11}/doc/abstract.tex +0 -0
- {ladok3-4.10 → ladok3-4.11}/doc/ladok3.tex +0 -0
- {ladok3-4.10 → ladok3-4.11}/makefiles/doc.mk +0 -0
- {ladok3-4.10 → ladok3-4.11}/makefiles/exam.mk +0 -0
- {ladok3-4.10 → ladok3-4.11}/makefiles/haskell.mk +0 -0
- {ladok3-4.10 → ladok3-4.11}/makefiles/miun.course.mk +0 -0
- {ladok3-4.10 → ladok3-4.11}/makefiles/miun.depend.mk +0 -0
- {ladok3-4.10 → ladok3-4.11}/makefiles/miun.docs.mk +0 -0
- {ladok3-4.10 → ladok3-4.11}/makefiles/miun.port.mk +0 -0
- {ladok3-4.10 → ladok3-4.11}/makefiles/miun.pub.mk +0 -0
- {ladok3-4.10 → ladok3-4.11}/makefiles/noweb.mk +0 -0
- {ladok3-4.10 → ladok3-4.11}/makefiles/pkg.mk +0 -0
- {ladok3-4.10 → ladok3-4.11}/makefiles/portability.mk +0 -0
- {ladok3-4.10 → ladok3-4.11}/makefiles/pub.mk +0 -0
- {ladok3-4.10 → ladok3-4.11}/makefiles/results.mk +0 -0
- {ladok3-4.10 → ladok3-4.11}/makefiles/subdir.mk +0 -0
- {ladok3-4.10 → ladok3-4.11}/makefiles/tex.mk +0 -0
- {ladok3-4.10 → ladok3-4.11}/makefiles/transform.mk +0 -0
- {ladok3-4.10 → ladok3-4.11}/src/ladok3/.gitignore +0 -0
- {ladok3-4.10 → ladok3-4.11}/src/ladok3/Makefile +0 -0
- {ladok3-4.10 → ladok3-4.11}/src/ladok3/api.nw +0 -0
- {ladok3-4.10 → ladok3-4.11}/src/ladok3/data.nw +0 -0
- {ladok3-4.10 → ladok3-4.11}/src/ladok3/ladok3.nw +0 -0
- {ladok3-4.10 → ladok3-4.11}/src/ladok3/report.nw +0 -0
- {ladok3-4.10 → ladok3-4.11}/src/ladok3/student.nw +0 -0
- {ladok3-4.10 → ladok3-4.11}/src/ladok3/undoc.nw +0 -0
|
@@ -522,6 +522,9 @@ def load_credentials(filename="config.json"):
|
|
|
522
522
|
|
|
523
523
|
First we try the newest format.
|
|
524
524
|
We try to fetch the institution and vars from the keyring.
|
|
525
|
+
|
|
526
|
+
Note that [[keyring]] returns [[None]] if the key doesn't exist, it doesn't
|
|
527
|
+
raise an exception.
|
|
525
528
|
<<fetch vars from keyring>>=
|
|
526
529
|
try:
|
|
527
530
|
institution = keyring.get_password("ladok3", "institution")
|
|
@@ -529,7 +532,9 @@ try:
|
|
|
529
532
|
|
|
530
533
|
vars = {}
|
|
531
534
|
for key in vars_keys.split(";"):
|
|
532
|
-
|
|
535
|
+
value = keyring.get_password("ladok3", key)
|
|
536
|
+
if value:
|
|
537
|
+
vars[key] = value
|
|
533
538
|
|
|
534
539
|
if institution and vars:
|
|
535
540
|
return institution, vars
|
|
@@ -542,12 +547,10 @@ supported KTH.
|
|
|
542
547
|
<<fetch username and password from keyring>>=
|
|
543
548
|
try:
|
|
544
549
|
institution = "KTH Royal Institute of Technology"
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
if vars:
|
|
550
|
-
return institution, vars
|
|
550
|
+
username = keyring.get_password("ladok3", "username")
|
|
551
|
+
password = keyring.get_password("ladok3", "password")
|
|
552
|
+
if username and password:
|
|
553
|
+
return institution, {"username": username, "password": password}
|
|
551
554
|
except:
|
|
552
555
|
pass
|
|
553
556
|
@
|
|
@@ -581,7 +584,10 @@ try:
|
|
|
581
584
|
|
|
582
585
|
vars = {}
|
|
583
586
|
for key in vars_keys.split(":"):
|
|
584
|
-
|
|
587
|
+
try:
|
|
588
|
+
vars[key] = os.environ[key]
|
|
589
|
+
except KeyError:
|
|
590
|
+
<<print warning about missing variable in [[LADOK_VARS]]>>
|
|
585
591
|
|
|
586
592
|
if institution and vars:
|
|
587
593
|
return institution, vars
|
|
@@ -589,6 +595,14 @@ except:
|
|
|
589
595
|
pass
|
|
590
596
|
@
|
|
591
597
|
|
|
598
|
+
Unlike in the other cases, we don't just ignore the exception of the key not
|
|
599
|
+
existing.
|
|
600
|
+
Since the user has explicitly specified the variable, we should warn them that
|
|
601
|
+
it doesn't exist.
|
|
602
|
+
<<print warning about missing variable in [[LADOK_VARS]]>>=
|
|
603
|
+
warn(f"Variable {key} not set, ignoring.")
|
|
604
|
+
@
|
|
605
|
+
|
|
592
606
|
If none of the above worked, the last resort is to try to read the
|
|
593
607
|
configuration file.
|
|
594
608
|
We pop the institution from the configuration file (a dictionary), because then
|
|
@@ -599,7 +613,7 @@ try:
|
|
|
599
613
|
config = json.load(conf_file)
|
|
600
614
|
|
|
601
615
|
institution = config.pop("institution",
|
|
602
|
-
|
|
616
|
+
"KTH Royal Institute of Technology")
|
|
603
617
|
return institution, config
|
|
604
618
|
except:
|
|
605
619
|
pass
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|