LogarithmPlotter/LogarithmPlotter/__init__.py

45 lines
1.7 KiB
Python
Raw Normal View History

2021-06-21 22:27:40 +00:00
"""
* LogarithmPlotter - 2D plotter software to make BODE plots, sequences and distribution functions.
* Copyright (C) 2022 Ad5001
2021-06-21 22:27:40 +00:00
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
from shutil import which
2021-06-21 22:27:40 +00:00
2022-04-23 00:17:34 +00:00
__VERSION__ = "0.2.1"
is_release = False
# Check if development version, if so get the date of the latest git patch
# and append it to the version string.
2022-01-24 17:27:16 +00:00
if not is_release and which('git') is not None:
from os.path import realpath, join, dirname, exists
from subprocess import check_output
from datetime import datetime
# Command to check date of latest git commit
cmd = ['git', 'log', '--format=%ci', '-n 1']
cwd = realpath(join(dirname(__file__), '..')) # Root AccountFree directory.
if exists(join(cwd, '.git')):
date_str = check_output(cmd, cwd=cwd).decode('utf-8').split(' ')[0]
try:
date = datetime.fromisoformat(date_str)
__VERSION__ += '.dev0+git' + date.strftime('%Y%m%d')
except ValueError:
# Date cannot be parsed, not git root?
pass
2021-06-21 22:27:40 +00:00
if __name__ == "__main__":
from .logarithmplotter import run
run()