#!/bin/sh
''':'
# This code will be treated as a comment in Python, but will be executed
# by the shell, allowing us to do some special handling before the python
# interpreter starts.
PYTHONPATH="" exec python3 "$0" "$@"
' '''

# 2023-11-13: Now ignores PYTHONPATH
# 2022-08-22: Now uses python3

import os
import sys
import datetime

PROBSPEC = "${GIANT_DATA_DIR}/probspec/genMan_default_r2_0/default_lei/v1_09b1a584-3dae-48d9-9a00-e6c253267cb4/default_lei.v1.psp"

def read_probspec(path):
	data = {}
	for line in open(path).read().split("\n"):
		if ":" not in line:
			continue
		key, value = line.split(":")
		data[key] = value
	return data

def scale_talent(first, last):
	first = first.lower()
	last = last.lower()
	date = datetime.datetime.now().strftime("%y%m%d%p").lower()
	name = "%s%s_%s.%s_%s.scale.prj" % (first[0], last[:2], date, first, last)

	project = os.path.expandvars(os.path.join("${GIANT_DATA_DIR}", "capture", "talent", name))
	print(project)

def main():
	if len(sys.argv) != 3:
		sys.stderr.write("USAGE: %s <first_name> <last_name>\n" % os.path.basename(sys.argv[0]))
		sys.exit(1)
	scale_talent(sys.argv[1], sys.argv[2])

if __name__ == '__main__':
	main()
