lib: Replace version.DEBUG with the __debug__ constant
Implements #27 (Check __debug__ constant instead of a .debug file) Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
10c5fd4cef
commit
db2d122211
|
@ -1,3 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
python {EMMENTAL_LIB}/emmental.py $*
|
||||
python -O {EMMENTAL_LIB}/emmental.py $*
|
||||
|
|
|
@ -7,7 +7,7 @@ import xdg.BaseDirectory
|
|||
__resource = "emmental"
|
||||
if version.TESTING == True:
|
||||
__resource = "emmental-testing"
|
||||
elif version.DEBUG == True:
|
||||
elif __debug__ == True:
|
||||
__resource = "emmental-debug"
|
||||
|
||||
READ = 'rb'
|
||||
|
|
|
@ -7,7 +7,7 @@ class TestVersion(unittest.TestCase):
|
|||
self.assertEqual(version.MAJOR, 2)
|
||||
self.assertEqual(version.MINOR, 9)
|
||||
|
||||
self.assertTrue(version.DEBUG)
|
||||
self.assertTrue(__debug__)
|
||||
self.assertTrue(version.TESTING)
|
||||
|
||||
self.assertEqual(version.string(), "Emmental 2.9-debug")
|
||||
|
|
|
@ -4,15 +4,7 @@ import sys
|
|||
|
||||
MAJOR = 2
|
||||
MINOR = 9
|
||||
|
||||
DEBUG = False
|
||||
if os.path.exists(".debug"):
|
||||
with open(".debug") as f:
|
||||
if f.read().strip() == "emmental":
|
||||
DEBUG = True
|
||||
|
||||
TESTING = "unittest" in sys.modules
|
||||
|
||||
|
||||
def string():
|
||||
return f"Emmental {MAJOR}.{MINOR}{'-debug' if DEBUG else ''}"
|
||||
return f"Emmental {MAJOR}.{MINOR}{'-debug' if __debug__ else ''}"
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
# Copyright 2021 (c) Anna Schumaker.
|
||||
from . import window
|
||||
from lib import version
|
||||
from gi.repository import Gtk
|
||||
import pathlib
|
||||
|
||||
IconPath = pathlib.Path("data/").absolute()
|
||||
|
||||
if version.DEBUG == True:
|
||||
if __debug__ == True:
|
||||
Display = Gtk.Label().get_display()
|
||||
Theme = Gtk.IconTheme.get_for_display(Display)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user