+ Added function to get date of last commit on py files

This commit is contained in:
j3rome 2021-06-24 05:35:20 -04:00
parent 0fde31ae8f
commit 9be0fa73b9

View File

@ -1,5 +1,7 @@
import re import re
import os import os
import subprocess
from datetime import datetime
from urllib.request import urlretrieve from urllib.request import urlretrieve
def user_response_multi_choices(message, choices): def user_response_multi_choices(message, choices):
@ -108,6 +110,15 @@ def get_python_filename_at_root():
return [f[:-3] for f in os.listdir('.') if os.path.isfile(f) and f.endswith('.py')] return [f[:-3] for f in os.listdir('.') if os.path.isfile(f) and f.endswith('.py')]
def get_date_last_modified_python_file():
timestamp = subprocess.check_output('git log -n 1 --all --pretty="format:%ct" -- "*.py"', shell=True).decode()
if len(timestamp) == 0:
return None
else:
return datetime.fromtimestamp(int(timestamp))
def detect_os(): def detect_os():
pass pass