updating header.py to set the default of panaetius if no __header__ or virtualenv has been detected

This commit is contained in:
2020-01-13 00:25:07 +00:00
parent 41fb8534dc
commit f0e00d8f2a

View File

@@ -11,14 +11,16 @@ try:
__spec.loader.exec_module(__header__) __spec.loader.exec_module(__header__)
__header__ = __header__.__header__ __header__ = __header__.__header__
except FileNotFoundError: except FileNotFoundError:
try:
venv = os.environ.get('VIRTUAL_ENV').split('/')[-1] venv = os.environ.get('VIRTUAL_ENV').split('/')[-1]
if venv is not None:
__header__ = venv __header__ = venv
else: except AttributeError:
raise FileNotFoundError( print(
f'Cannot find a __header__.py file in {os.getcwd()} containing the' f'Cannot find a __header__.py file in {os.getcwd()} containing the'
' __header__ value of your project name and you are not working' ' __header__ value of your project name and you are not working'
' from a virtual environment. Either make sure this file ' ' from a virtual environment. Either make sure this file '
'exists and the value is set or create and work from a virtual ' 'exists and the value is set or create and work from a virtual '
'environment and try again.' 'environment and try again. \n The __header__ value has been '
'set to the default of panaetius.'
) )
__header__ = 'panaetius'