ladok3 4.10__tar.gz → 4.12__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.12}/PKG-INFO +1 -1
- {ladok3-4.10 → ladok3-4.12}/doc/preamble.tex +1 -1
- {ladok3-4.10 → ladok3-4.12}/pyproject.toml +1 -1
- {ladok3-4.10 → ladok3-4.12}/src/ladok3/cli.nw +26 -10
- {ladok3-4.10 → ladok3-4.12}/LICENSE +0 -0
- {ladok3-4.10 → ladok3-4.12}/README.md +0 -0
- {ladok3-4.10 → ladok3-4.12}/doc/Makefile +0 -0
- {ladok3-4.10 → ladok3-4.12}/doc/abstract.tex +0 -0
- {ladok3-4.10 → ladok3-4.12}/doc/ladok3.tex +0 -0
- {ladok3-4.10 → ladok3-4.12}/makefiles/doc.mk +0 -0
- {ladok3-4.10 → ladok3-4.12}/makefiles/exam.mk +0 -0
- {ladok3-4.10 → ladok3-4.12}/makefiles/haskell.mk +0 -0
- {ladok3-4.10 → ladok3-4.12}/makefiles/miun.course.mk +0 -0
- {ladok3-4.10 → ladok3-4.12}/makefiles/miun.depend.mk +0 -0
- {ladok3-4.10 → ladok3-4.12}/makefiles/miun.docs.mk +0 -0
- {ladok3-4.10 → ladok3-4.12}/makefiles/miun.port.mk +0 -0
- {ladok3-4.10 → ladok3-4.12}/makefiles/miun.pub.mk +0 -0
- {ladok3-4.10 → ladok3-4.12}/makefiles/noweb.mk +0 -0
- {ladok3-4.10 → ladok3-4.12}/makefiles/pkg.mk +0 -0
- {ladok3-4.10 → ladok3-4.12}/makefiles/portability.mk +0 -0
- {ladok3-4.10 → ladok3-4.12}/makefiles/pub.mk +0 -0
- {ladok3-4.10 → ladok3-4.12}/makefiles/results.mk +0 -0
- {ladok3-4.10 → ladok3-4.12}/makefiles/subdir.mk +0 -0
- {ladok3-4.10 → ladok3-4.12}/makefiles/tex.mk +0 -0
- {ladok3-4.10 → ladok3-4.12}/makefiles/transform.mk +0 -0
- {ladok3-4.10 → ladok3-4.12}/src/ladok3/.gitignore +0 -0
- {ladok3-4.10 → ladok3-4.12}/src/ladok3/Makefile +0 -0
- {ladok3-4.10 → ladok3-4.12}/src/ladok3/api.nw +0 -0
- {ladok3-4.10 → ladok3-4.12}/src/ladok3/data.nw +0 -0
- {ladok3-4.10 → ladok3-4.12}/src/ladok3/ladok3.nw +0 -0
- {ladok3-4.10 → ladok3-4.12}/src/ladok3/report.nw +0 -0
- {ladok3-4.10 → ladok3-4.12}/src/ladok3/student.nw +0 -0
- {ladok3-4.10 → ladok3-4.12}/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
|
@
|
|
@@ -567,7 +570,7 @@ try:
|
|
|
567
570
|
"username": os.environ["LADOK_USER"],
|
|
568
571
|
"password": os.environ["LADOK_PASS"]
|
|
569
572
|
}
|
|
570
|
-
if institution and vars:
|
|
573
|
+
if institution and vars["username"] and vars["password"]:
|
|
571
574
|
return institution, vars
|
|
572
575
|
except:
|
|
573
576
|
pass
|
|
@@ -581,7 +584,12 @@ try:
|
|
|
581
584
|
|
|
582
585
|
vars = {}
|
|
583
586
|
for key in vars_keys.split(":"):
|
|
584
|
-
|
|
587
|
+
try:
|
|
588
|
+
value = os.environ[key]
|
|
589
|
+
if value:
|
|
590
|
+
vars[key] = value
|
|
591
|
+
except KeyError:
|
|
592
|
+
<<print warning about missing variable in [[LADOK_VARS]]>>
|
|
585
593
|
|
|
586
594
|
if institution and vars:
|
|
587
595
|
return institution, vars
|
|
@@ -589,6 +597,14 @@ except:
|
|
|
589
597
|
pass
|
|
590
598
|
@
|
|
591
599
|
|
|
600
|
+
Unlike in the other cases, we don't just ignore the exception of the key not
|
|
601
|
+
existing.
|
|
602
|
+
Since the user has explicitly specified the variable, we should warn them that
|
|
603
|
+
it doesn't exist.
|
|
604
|
+
<<print warning about missing variable in [[LADOK_VARS]]>>=
|
|
605
|
+
warn(f"Variable {key} not set, ignoring.")
|
|
606
|
+
@
|
|
607
|
+
|
|
592
608
|
If none of the above worked, the last resort is to try to read the
|
|
593
609
|
configuration file.
|
|
594
610
|
We pop the institution from the configuration file (a dictionary), because then
|
|
@@ -599,7 +615,7 @@ try:
|
|
|
599
615
|
config = json.load(conf_file)
|
|
600
616
|
|
|
601
617
|
institution = config.pop("institution",
|
|
602
|
-
|
|
618
|
+
"KTH Royal Institute of Technology")
|
|
603
619
|
return institution, config
|
|
604
620
|
except:
|
|
605
621
|
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
|