Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions cmds/cmd_package/cmd_package_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ def package_wizard():
print('\033[5;33;40m\n1.Please input a new package name :\033[0m')

name = user_input()
regular_obj = re.compile('\W')
while name == '' or name.isspace() == True or regular_obj.search(name.strip()):
regular_obj = re.compile('^[\w\d_-]*$')
while name == '' or name.isspace() == True or regular_obj.search(name.strip()) == None:
if name == '' or name.isspace():
print('\033[1;31;40mError: you must input a package name. Try again.\033[0m')
name = user_input()
else:
print('\033[1;31;40mError: package name is made of alphabet, number and underline. Try again.\033[0m')
print('\033[1;31;40mError: package name is made of alphabet, number, underline and dash. Try again.\033[0m')
name = user_input()

default_description = 'Please add description of ' + name + ' in English.'
Expand Down Expand Up @@ -155,6 +155,7 @@ def package_wizard():

s = Template(Kconfig_file)
upper_name = str.upper(name)
upper_name = upper_name.replace('-', '_')
kconfig = s.substitute(name=upper_name, description=description, version=ver,
pkgs_class=package_class, lowercase_name=name, version_standard=ver_standard)
f = open(os.path.join(pkg_path, 'Kconfig'), 'w')
Expand Down