Fixed error with MLB generatio & changed pyinstaller folders

This commit is contained in:
David Parsons 2016-06-04 19:51:17 +01:00
parent a2cf1640fa
commit 7b0536dcd7
5 changed files with 60 additions and 77 deletions

7
.gitignore vendored
View File

@ -1,9 +1,4 @@
backup/ backup/
tools/ tools/
.idea/ .idea/
unlocker/build pyinstaller/
unlocker/dist
dumpsmc/build
dumpsmc/dist
gettools/build
gettools/dist

View File

@ -1,17 +0,0 @@
# -*- mode: python -*-
a = Analysis(['D:\\vmware\\unlocker\\dumpsmc.py'],
pathex=['D:\\PyInstaller-2.1\\dumpsmc'],
hiddenimports=[],
hookspath=None,
runtime_hooks=None)
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='dumpsmc.exe',
debug=False,
strip=None,
upx=True,
console=True )

View File

@ -1,18 +1,47 @@
"""
The MIT License (MIT)
Copyright (c) 2016 Dave Parsons
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the 'Software'), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""
import json import json
import random import random
import string import string
import sys
# Years and months # Years and months
# 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 # 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022
years = ['C','D','F','G','H','J','K','L','M','N','P','Q','R','T','V','W','X','Y','1','2','3','4','5','6','7','8'] years = ['C', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'T', 'V', 'W', 'X', 'Y', '1', '2', '3', '4',
'5', '6', '7', '8']
# Week numbers from 1-52 # Week numbers from 1-52
# B is used to shift indexing to 1 and is not used # B is used to shift indexing to 1 and is not used
weeks = ['B','C','D','F','G','H','J','K','L','M','N','P','Q','R','T','V','W','X','Y','1','2','3','4','5','6','7','8', weeks = ['B', 'C', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'T', 'V', 'W', 'X', 'Y', '1', '2', '3',
'C','D','F','G','H','J','K','L','M','N','P','Q','R','T','V','W','X','Y','1','2','3','4','5','6','7','8'] '4', '5', '6', '7', '8',
'C', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'T', 'V', 'W', 'X', 'Y', '1', '2', '3', '4',
'5', '6', '7', '8']
# Values to generate 3 code production number # Values to generate 3 code production number
production = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z', production = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U',
'V', 'W', 'X', 'Y', 'Z',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
# MLB codes # MLB codes
@ -26,14 +55,14 @@ eeee = ['DYWF', 'F117', 'F502', 'F505', 'F9GY', 'F9H0', 'F9H1', 'F9H2', 'DYWD',
'FF4L', 'FF4M', 'FF4N', 'FF4P', 'DNY3', 'DP00', 'DJWK', 'DM66', 'DNJK', 'DKG1', 'DM65', 'DNJJ', 'DKG2', 'FF4L', 'FF4M', 'FF4N', 'FF4P', 'DNY3', 'DP00', 'DJWK', 'DM66', 'DNJK', 'DKG1', 'DM65', 'DNJJ', 'DKG2',
'DM67', 'DNJL', 'DJWM', 'DMT3', 'DMT5', 'DJWN', 'DM69', 'DJWP', 'DM6C'] 'DM67', 'DNJL', 'DJWM', 'DMT3', 'DMT5', 'DJWN', 'DM69', 'DJWP', 'DM6C']
kk = ['1H', '1M' 'AD' '1F' 'A8' 'UE' 'JA' 'JC' '8C' 'CB' 'FB'] kk = ['1H', '1M', 'AD', '1F', 'A8', 'UE', 'JA', 'JC', '8C', 'CB', 'FB']
# Loaded JSON model database # Loaded JSON model database
smbiosdb = {} smbiosdb = {}
model = None model = None
year = None year = 2010
week = None week = 1
yearweek = None yearweek = None
run = None run = None
mlb = None mlb = None
@ -53,8 +82,8 @@ def getmlb():
if model['serial.type'] == 11: if model['serial.type'] == 11:
mlb = yearweek + '0' + run + id_generator(4) mlb = yearweek + '0' + run + id_generator(4)
elif model['serial.type'] == 12: elif model['serial.type'] == 12:
mlb = 'C02{0}{1}{2}{3}{4}{5}'.format(str(year - 2010), str(week).zfill(2), mlb = 'C02{0}{1}{2}{3}{4}{5}'.format(str(year - 2010), str(week).zfill(2), random.choice(ttt),
random.choice(ttt), random.choice(cc), random.choice(eeee), random.choice(kk)) random.choice(cc), random.choice(eeee), random.choice(kk))
else: else:
pass pass
@ -69,7 +98,10 @@ def getmodel():
while True: while True:
try: try:
index = int(raw_input('Please enter model family [1-6]: ')) index = int(raw_input('Please enter model family [1-6]: '))
except: except KeyboardInterrupt:
print "Goodbye!"
sys.exit(0)
except ValueError:
print "This is not a number." print "This is not a number."
else: else:
if (index >= 1) and (index <= 6): if (index >= 1) and (index <= 6):
@ -90,7 +122,10 @@ def getmodel():
while True: while True:
try: try:
index = int(raw_input('Please enter model [1-{}]: '.format(i - 1))) index = int(raw_input('Please enter model [1-{}]: '.format(i - 1)))
except: except KeyboardInterrupt:
print "Goodbye!"
sys.exit(0)
except ValueError:
print "This is not a number." print "This is not a number."
else: else:
if (index >= 1) and (index <= (i - 1)): if (index >= 1) and (index <= (i - 1)):
@ -136,11 +171,14 @@ def getweek():
# Get a week number # Get a week number
while True: while True:
try: try:
week = int(input('Please enter week for year {0} (1 - 53): '.format(year))) week = int(input('Please enter week for year {0} (1 - 52): '.format(year)))
except: except KeyboardInterrupt:
print "Goodbye!"
sys.exit(0)
except ValueError:
print "This is not a week number." print "This is not a week number."
else: else:
if (week >= 1) and (week <= 53): if (week >= 1) and (week <= 52):
break break
else: else:
print 'Invalid week: ', week print 'Invalid week: ', week
@ -169,6 +207,7 @@ def main():
getweek() getweek()
getrun() getrun()
getmlb() getmlb()
getrom()
print print
print '# Passthru host definitions - FALSE' print '# Passthru host definitions - FALSE'
print 'board-id.reflectHost = "FALSE"' print 'board-id.reflectHost = "FALSE"'

View File

@ -1,17 +0,0 @@
# -*- mode: python -*-
a = Analysis(['D:\\vmware\\unlocker\\gettools.py'],
pathex=['D:\\PyInstaller-2.1\\gettools'],
hiddenimports=[],
hookspath=None,
runtime_hooks=None)
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='gettools.exe',
debug=False,
strip=None,
upx=True,
console=True )

View File

@ -1,17 +0,0 @@
# -*- mode: python -*-
a = Analysis(['D:\\vmware\\unlocker\\unlocker.py'],
pathex=['D:\\PyInstaller-2.1\\unlocker'],
hiddenimports=[],
hookspath=None,
runtime_hooks=None)
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='unlocker.exe',
debug=False,
strip=None,
upx=True,
console=True )