aboutsummaryrefslogtreecommitdiff
path: root/Python/setup.sh
blob: f094e00fe5be7fef71b7ce33480435a39c0a7cde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env sh
# Setup a Python environment using ArKa coding style

vcs=true
project_name="$1"
script_dir="$(cd "$(dirname "$0")" && pwd)"

# Parsing args
for arg in "$@"; do
	if [ "$arg" = "--no-vcs" ]; then
		vcs=false
	else
		project_name="$arg"
	fi
done

if [ -n "$project_name" ]; then
	printf "Installing your environment...\n"
	mkdir -p "$project_name" || exit
	cd "$project_name"
	
	# If vcs is true, init git in the project
	if [ "$vcs" = true ]; then
		printf "Setting up git in %s\n" "$project_name"
		git init
		cp "$script_dir"/.gitignore .gitignore
	fi

	printf "Setting up Python virtual environment + needed dev requirements\n"
	python3 -m venv .venv
	source .venv/bin/activate
	cp "$script_dir"/requirements_dev.txt requirements_dev.txt
	pip install -r requirements_dev.txt
	# copy linters, formatters config
	printf "Your python environment is now ready, enjoy :)\n"
else
	printf "Usage:\n\t%s [--no-vcs] {dirname}\n\n\t--no-vcs: git vcs not added to the project\n" "$0"
fi
ArKa projects. All rights to me, and your next child right arm.