Hello world
This commit is contained in:
parent
bd818ef2f0
commit
0e6421ef58
|
@ -0,0 +1 @@
|
|||
helloworld.py # show a hello world message in terminal, as the simplest check
|
|
@ -0,0 +1 @@
|
|||
print("Hello world!")
|
|
@ -0,0 +1,6 @@
|
|||
with open(oxiGetConfig("autorun.txt"),encoding="utf-8") as autorunh:
|
||||
for line in autorunh:
|
||||
line = line.split("#",1)[0]
|
||||
line = line.strip(" \t\r\n")
|
||||
if line == "": continue
|
||||
oxiRunScript(oxiGetConfig(line))
|
|
@ -0,0 +1,22 @@
|
|||
global oxiDistro
|
||||
oxiDistro = "oxiDE"
|
||||
|
||||
global oxiMakeConfigPaths
|
||||
def oxiMakeConfigPaths():
|
||||
global oxiConfigPaths
|
||||
oxiConfigPaths = []
|
||||
if os.name == "nt":
|
||||
oxiConfigPaths.append(p(os.environ["APPDATA"],oxiDistro))
|
||||
else:
|
||||
oxiConfigPaths.append(p(os.environ["HOME"],".config",oxiDistro))
|
||||
oxiConfigPaths.append(p(sp,"config"))
|
||||
|
||||
global oxiGetConfig
|
||||
def oxiGetConfig(file):
|
||||
for cpath in oxiConfigPaths:
|
||||
ffile = p(cpath,file)
|
||||
if os.path.isfile(ffile): return ffile
|
||||
return False
|
||||
|
||||
oxiMakeConfigPaths()
|
||||
oxiRunScript(oxiGetConfig("userMain.py"))
|
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/env python3
|
||||
import sys
|
||||
|
||||
oldexcepthook = sys.excepthook
|
||||
def newexcepthook(type,value,traceback):
|
||||
oldexcepthook(type,value,traceback)
|
||||
input("Press ENTER to quit.")
|
||||
sys.excepthook = newexcepthook
|
||||
|
||||
import os
|
||||
p = os.path.join
|
||||
pUp = os.path.dirname
|
||||
s = False
|
||||
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
|
||||
s = os.path.realpath(sys.executable)
|
||||
else:
|
||||
s = os.path.realpath(__file__)
|
||||
sp = pUp(s)
|
||||
|
||||
# script start
|
||||
def oxiRunCode(str, lcs = False, description = "loose-code"):
|
||||
if lcs == False: lcs = {}
|
||||
code = compile(str,description,"exec")
|
||||
exec(code,globals(),lcs)
|
||||
return lcs
|
||||
|
||||
def oxiRunScript(sf,lcs = False):
|
||||
if lcs == False: lcs = {}
|
||||
with open(sf) as script:
|
||||
oxiRunCode(script.read(),lcs,sf)
|
||||
return lcs
|
||||
|
||||
def main():
|
||||
oxiRunScript(p(sp,"main.py"))
|
||||
main()
|
Loading…
Reference in New Issue