Browse Source

minor cleanups

The MMGen Project 4 years ago
parent
commit
21ba2476eb
5 changed files with 16 additions and 8 deletions
  1. 5 2
      mmgen/tool.py
  2. 1 1
      mmgen/tx.py
  3. 7 4
      mmgen/util.py
  4. 1 1
      scripts/traceback_run.py
  5. 2 0
      setup.py

+ 5 - 2
mmgen/tool.py

@@ -100,8 +100,11 @@ def _usage(cmd=None,exit_val=1):
 			Msg('')
 		Msg(m2)
 	elif cmd in MMGenToolCmds:
-		msg('{}'.format(capfirst(MMGenToolCmds[cmd].__doc__.strip())))
-		msg('USAGE: {} {} {}'.format(g.prog_name,cmd,_create_call_sig(cmd)))
+		msg('{}USAGE: {} {} {}'.format(
+			fmt(capfirst(MMGenToolCmds[cmd].__doc__.strip()),strip_char='\t'),
+			g.prog_name,cmd,
+			_create_call_sig(cmd))
+		)
 	else:
 		die(1,"'{}': no such tool command".format(cmd))
 

+ 1 - 1
mmgen/tx.py

@@ -1361,7 +1361,7 @@ class MMGenTX:
 						msg('Transaction is in mempool')
 					else:
 						msg(f'TX status: in mempool, {rep}')
-						msg('Sent {} ({} h/m/s ago)'.format(
+						msg('Sent {} ({} ago)'.format(
 							time.strftime('%c',time.gmtime(t)),
 							secs_to_dhms(int(time.time()-t))) )
 				else:

+ 7 - 4
mmgen/util.py

@@ -335,10 +335,13 @@ def make_timestr(secs=None):
 	return '{}-{:02d}-{:02d} {:02d}:{:02d}:{:02d}'.format(*time.gmtime(t)[:6])
 
 def secs_to_dhms(secs):
-	dsecs = secs//3600
-	return '{}{:02d}:{:02d}:{:02d}'.format(
-		('','{} day{}, '.format(dsecs//24,suf(dsecs//24)))[dsecs > 24],
-		dsecs % 24, (secs//60) % 60, secs % 60)
+	dsecs = secs // 3600
+	return '{}{:02d}:{:02d}:{:02d} h/m/s'.format(
+		('{} day{}, '.format(dsecs//24,suf(dsecs//24)) if dsecs > 24 else ''),
+		dsecs % 24,
+		(secs // 60) % 60,
+		secs % 60
+	)
 
 def secs_to_hms(secs):
 	return '{:02d}:{:02d}:{:02d}'.format(secs//3600, (secs//60) % 60, secs % 60)

+ 1 - 1
scripts/traceback_run.py

@@ -58,4 +58,4 @@ except Exception as e:
 	sys.exit(retval)
 
 blue = lambda s: s if os.getenv('MMGEN_DISABLE_COLOR') else '\033[34;1m{}\033[0m'.format(s)
-sys.stdout.write(blue('Runtime: {:0.5f} secs\n'.format(time.time() - traceback_run_tstart)))
+sys.stderr.write(blue('Runtime: {:0.5f} secs\n'.format(time.time() - traceback_run_tstart)))

+ 2 - 0
setup.py

@@ -82,6 +82,8 @@ module1 = Extension(
 	include_dirs = ['/usr/local/include',r'C:\msys64\mingw64\include',r'C:\msys64\usr\include'],
 	)
 
+os.umask(0o0022)
+
 from mmgen.globalvars import g
 setup(
 		name         = 'mmgen',