Browse Source

minor fixes and cleanups

The MMGen Project 3 years ago
parent
commit
f9b6c78f4a
3 changed files with 11 additions and 9 deletions
  1. 4 7
      mmgen/led.py
  2. 1 1
      setup.cfg
  3. 6 1
      test/unit_tests_d/ut_dep.py

+ 4 - 7
mmgen/led.py

@@ -101,21 +101,18 @@ class LEDControl:
 				iv = init_val or open(fn).read().strip()
 				open(fn,'w').write(f'{iv}\n')
 				return True
-			except:
-				msg('\n'+fmt(f"""
+			except PermissionError:
+				ydie(1,'\n'+fmt(f"""
 					You do not have access to the {desc} file
 					To allow access, run the following command:
 
 					    sudo chmod 0666 {fn}
 				""",indent='  ',strip_char='\t'))
-				return False
 
-		if not check_access(board.status,desc='status LED control'):
-			sys.exit(1)
+		check_access(board.status,desc='status LED control')
 
 		if board.trigger:
-			if not check_access(board.trigger,desc='LED trigger',init_val=board.trigger_states[0]):
-				sys.exit(1)
+			check_access(board.trigger,desc='LED trigger',init_val=board.trigger_states[0])
 
 		self.board = board
 

+ 1 - 1
setup.cfg

@@ -34,7 +34,7 @@ install_requires =
 	requests
 	pysocks # xmrwallet.py
 	pexpect
-	scrypt
+	scrypt; platform_system != "Windows" # requires user intervention to install on MSYS2
 	semantic-version # scripts/create-token.py
 	aiohttp; platform_system != "Windows"
 	pysha3; platform_system != "Windows"

+ 6 - 1
test/unit_tests_d/ut_dep.py

@@ -11,7 +11,12 @@ from mmgen.common import *
 class unit_tests:
 
 	altcoin_deps = ('pysha3','py_ecc')
-	win_skip = ('aiohttp','pysha3')
+	win_skip = ('aiohttp','pysha3','led')
+
+	def led(self,name,ut):
+		from mmgen.led import LEDControl
+		LEDControl(enabled=True)
+		return True
 
 	def pysha3(self,name,ut): # ETH,XMR
 		from sha3 import keccak_256