Skip to content

Commit

Permalink
check for current directory
Browse files Browse the repository at this point in the history
  • Loading branch information
SunQpark committed Apr 24, 2019
1 parent 9bd42ab commit e801069
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion new_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@
# This script initializes new pytorch project with the template files.
# Run `python3 new_project.py ../MyNewProject` then new project named
# MyNewProject will be made
current_dir = Path()
assert (current_dir / 'new_project.py').is_file(), 'Script should be executed in the pytorch-template directory'
assert len(sys.argv) == 2, 'Specify a name for the new project. Example: python3 new_project.py MyNewProject'

project_name = Path(sys.argv[1])
target_dir = current_dir / project_name

ignore = [".git", "data", "saved", "new_project.py", "LICENSE", ".flake8", "README.md", "__pycache__"]
copytree('.', project_name, ignore=ignore_patterns(*ignore))
copytree(current_dir, target_dir, ignore=ignore_patterns(*ignore))
print('New project initialized at', target_dir.absolute().resolve())

0 comments on commit e801069

Please sign in to comment.