Skip to content

Commit

Permalink
Merge pull request #145 from nimblehq/bug/135-fix-the-script-is-faile…
Browse files Browse the repository at this point in the history
…d-on-python-3.8

[#135] Fix: The script is failed at clean_up step on Python 3.8
  • Loading branch information
luongvo authored Jan 17, 2023
2 parents 98206d1 + a7b5be2 commit 5fee81d
Showing 1 changed file with 43 additions and 39 deletions.
82 changes: 43 additions & 39 deletions scripts/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ def move_project_to_root(project):
cur_dir = os.getcwd()
shutil.copytree(project.project_path, cur_dir, copy_function=shutil.move, dirs_exist_ok=True)

def clean_up(files: list[str]):
def clean_up(files):
cur_dir = os.getcwd()
for file in files:
file_path = cur_dir + os.sep + file
Expand All @@ -402,41 +402,45 @@ def clean_up(files: list[str]):
os.remove(file_path)

if __name__ == "__main__":
args = handleParameters()

project = Project(
args.project_path,
args.package_name,
args.app_name,
args.project_name,
args.app_version,
args.build_number
)
validate_parameters(project)

if os.environ.get("CI") != "true":
options = {
'none': 'none',
'kebab (kebab-case)': 'kebab',
'snake (snake_case)': 'snake',
'pascal (PascalCase)': 'pascal'
}
choice = enquiries.choose('Choose default json_serializable.field_rename: ', options.keys())
project.json_serializable = JsonSerializable(options[choice])
else:
# Skip enquiries on CI
project.json_serializable = JsonSerializable('snake')

print(f"=> 🐢 Starting init {project.new_project_name} with {project.new_package}...")
android = Android(project)
android.run()
ios = Ios(project)
ios.run()
flutter = Flutter(project)
flutter.run()
print('🤖 Generating project...')
# Remove the `.github` folder to avoid redundant workflow
clean_up(['.github'])
move_project_to_root(project)
clean_up(['.template', 'LICENSE', 'Makefile'])
print("=> 🚀 Done! Project is ready for the next development 🙌")
try:
args = handleParameters()

project = Project(
args.project_path,
args.package_name,
args.app_name,
args.project_name,
args.app_version,
args.build_number
)
validate_parameters(project)

if os.environ.get("CI") != "true":
options = {
'none': 'none',
'kebab (kebab-case)': 'kebab',
'snake (snake_case)': 'snake',
'pascal (PascalCase)': 'pascal'
}
choice = enquiries.choose('Choose default json_serializable.field_rename: ', options.keys())
project.json_serializable = JsonSerializable(options[choice])
else:
# Skip enquiries on CI
project.json_serializable = JsonSerializable('snake')

print(f"=> 🐢 Starting init {project.new_project_name} with {project.new_package}...")
android = Android(project)
android.run()
ios = Ios(project)
ios.run()
flutter = Flutter(project)
flutter.run()
print('🤖 Generating project...')
# Remove the `.github` folder to avoid redundant workflow
clean_up(['.github'])
move_project_to_root(project)
clean_up(['.template', 'LICENSE', 'Makefile'])
print("=> 🚀 Done! Project is ready for the next development 🙌")
except:
print("❌ There is something wrong! Please try again.")
sys.exit()

0 comments on commit 5fee81d

Please sign in to comment.