mirror of
https://github.com/J3rome/py-requirements-guesser.git
synced 2024-11-21 17:35:15 +01:00
+ Added function to get date of last commit on py files
This commit is contained in:
parent
0fde31ae8f
commit
9be0fa73b9
11
utils.py
11
utils.py
@ -1,5 +1,7 @@
|
||||
import re
|
||||
import os
|
||||
import subprocess
|
||||
from datetime import datetime
|
||||
from urllib.request import urlretrieve
|
||||
|
||||
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')]
|
||||
|
||||
|
||||
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():
|
||||
pass
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user