Skip to content

Commit a293512

Browse files
committed
fix: windows compatibility
1 parent 144fe7f commit a293512

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

main.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,14 @@
1313
import os
1414
import subprocess
1515

16-
def get_serial_number_aux():
17-
os_type = sys.platform.lower()
18-
if "darwin" in os_type:
19-
command = "ioreg -l | grep IOPlatformSerialNumber"
20-
elif "win" in os_type:
21-
command = "wmic bios get serialnumber"
22-
elif "linux" in os_type:
23-
command = "dmidecode -s baseboard-serial-number"
24-
return os.popen(command).read().replace("\n", "").replace(" ", "").replace(" ", "")
2516

2617
def get_serial_number():
2718
try:
2819
system = platform.system()
2920
if system == 'Windows':
30-
return os.popen("wmic bios get serialnumber").read().replace("\n", "").replace(" ", "").replace(" ", "").replace("SerialNumber", "")
21+
return os.popen("wmic bios get serialnumber").read().replace("\n", "").replace(" ", "").replace(" ",
22+
"").replace(
23+
"SerialNumber", "")
3124
elif system == 'Linux':
3225
if os.geteuid() != 0:
3326
print("Process needs to be root.")
@@ -44,7 +37,8 @@ def get_serial_number():
4437

4538
serial_number = get_serial_number()
4639
if not serial_number:
47-
print("Impossible de récupérer le numéro de série.")
40+
print("Impossible de récupérer le numéro de série. Votre système est-il compatible ? Liste des systèmes "
41+
"compatibles : Windows, Linux")
4842
sys.exit(1)
4943
else:
5044
print("Serial number : ", serial_number)

0 commit comments

Comments
 (0)