mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 17:12:13 -06:00
print version on startup
This commit is contained in:
parent
88701157d5
commit
1b94a4a74c
|
@ -18,6 +18,7 @@ from textwrap import dedent
|
||||||
from .__init__ import E
|
from .__init__ import E
|
||||||
from .__version__ import S_VERSION, S_BUILD_DT
|
from .__version__ import S_VERSION, S_BUILD_DT
|
||||||
from .svchub import SvcHub
|
from .svchub import SvcHub
|
||||||
|
from .util import py_desc
|
||||||
|
|
||||||
|
|
||||||
class RiceFormatter(argparse.HelpFormatter):
|
class RiceFormatter(argparse.HelpFormatter):
|
||||||
|
@ -69,7 +70,7 @@ def ensure_cert():
|
||||||
try:
|
try:
|
||||||
if filecmp.cmp(cert_cfg, cert_insec):
|
if filecmp.cmp(cert_cfg, cert_insec):
|
||||||
print(
|
print(
|
||||||
"\033[33m\n using default TLS certificate; https will be insecure."
|
"\033[33m using default TLS certificate; https will be insecure."
|
||||||
+ "\033[36m\n certificate location: {}\033[0m\n".format(cert_cfg)
|
+ "\033[36m\n certificate location: {}\033[0m\n".format(cert_cfg)
|
||||||
)
|
)
|
||||||
except:
|
except:
|
||||||
|
@ -80,6 +81,9 @@ def ensure_cert():
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
f = "\033[36mcopyparty v{} ({})\n python v{}\033[0m\n"
|
||||||
|
print(f.format(S_VERSION, S_BUILD_DT, py_desc()))
|
||||||
|
|
||||||
ensure_locale()
|
ensure_locale()
|
||||||
ensure_cert()
|
ensure_cert()
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
VERSION = (0, 1, 0)
|
VERSION = (0, 2, 0)
|
||||||
BUILD_DT = (2019, 6, 13)
|
BUILD_DT = (2019, 7, 8)
|
||||||
|
|
||||||
S_VERSION = ".".join(map(str, VERSION))
|
S_VERSION = ".".join(map(str, VERSION))
|
||||||
S_BUILD_DT = "{0:04d}-{1:02d}-{2:02d}".format(*BUILD_DT)
|
S_BUILD_DT = "{0:04d}-{1:02d}-{2:02d}".format(*BUILD_DT)
|
||||||
|
|
|
@ -6,6 +6,7 @@ import sys
|
||||||
import base64
|
import base64
|
||||||
import struct
|
import struct
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import platform
|
||||||
import threading
|
import threading
|
||||||
import subprocess as sp # nosec
|
import subprocess as sp # nosec
|
||||||
|
|
||||||
|
@ -469,6 +470,18 @@ def gzip_orig_sz(fn):
|
||||||
return struct.unpack("I", f.read(4))[0]
|
return struct.unpack("I", f.read(4))[0]
|
||||||
|
|
||||||
|
|
||||||
|
def py_desc():
|
||||||
|
py_ver = ".".join([str(x) for x in sys.version_info])
|
||||||
|
ofs = py_ver.find(".final.")
|
||||||
|
if ofs > 0:
|
||||||
|
py_ver = py_ver[:ofs]
|
||||||
|
|
||||||
|
bitness = struct.calcsize("P") * 8
|
||||||
|
host_os = platform.system()
|
||||||
|
|
||||||
|
return "{0} on {1}{2}".format(py_ver, host_os, bitness)
|
||||||
|
|
||||||
|
|
||||||
class Pebkac(Exception):
|
class Pebkac(Exception):
|
||||||
def __init__(self, code, msg=None):
|
def __init__(self, code, msg=None):
|
||||||
super(Pebkac, self).__init__(msg or HTTPCODE[code])
|
super(Pebkac, self).__init__(msg or HTTPCODE[code])
|
||||||
|
|
Loading…
Reference in a new issue