mkdocs-document-dates 1.9.0__tar.gz → 1.9.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/PKG-INFO +1 -1
- {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/hooks/pre-commit +20 -6
- {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates.egg-info/PKG-INFO +1 -1
- {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/setup.py +15 -16
- {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/LICENSE +0 -0
- {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/README.md +0 -0
- {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/__init__.py +0 -0
- {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/__init__.py +0 -0
- {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/ar.py +0 -0
- {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/de.py +0 -0
- {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/en.py +0 -0
- {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/es.py +0 -0
- {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/fr.py +0 -0
- {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/ja.py +0 -0
- {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/ko.py +0 -0
- {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/ru.py +0 -0
- {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/zh.py +0 -0
- {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/zh_tw.py +0 -0
- {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/plugin.py +0 -0
- {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/styles.py +0 -0
- {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates.egg-info/SOURCES.txt +0 -0
- {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates.egg-info/dependency_links.txt +0 -0
- {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates.egg-info/entry_points.txt +0 -0
- {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates.egg-info/requires.txt +0 -0
- {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates.egg-info/top_level.txt +0 -0
- {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/setup.cfg +0 -0
{mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/hooks/pre-commit
RENAMED
@@ -1,13 +1,28 @@
|
|
1
1
|
#!/usr/bin/env python3
|
2
|
+
|
2
3
|
import os
|
3
4
|
import sys
|
4
5
|
import json
|
5
6
|
import platform
|
6
7
|
import subprocess
|
7
|
-
import logging
|
8
8
|
from datetime import datetime
|
9
9
|
from pathlib import Path
|
10
10
|
|
11
|
+
# 添加调试日志到项目的 docs 目录
|
12
|
+
def log_debug(message):
|
13
|
+
try:
|
14
|
+
git_root = Path(subprocess.check_output(
|
15
|
+
['git', 'rev-parse', '--show-toplevel'],
|
16
|
+
text=True
|
17
|
+
).strip())
|
18
|
+
|
19
|
+
docs_dir = git_root / 'docs'
|
20
|
+
if docs_dir.exists():
|
21
|
+
with open(docs_dir / '.hook_debug.log', 'a') as f:
|
22
|
+
f.write(f"{datetime.now()}: {message}\n")
|
23
|
+
except:
|
24
|
+
pass # 静默失败,不影响主流程
|
25
|
+
|
11
26
|
# 配置日志
|
12
27
|
def setup_logging():
|
13
28
|
"""设置日志"""
|
@@ -38,12 +53,11 @@ def setup_logging():
|
|
38
53
|
|
39
54
|
if __name__ == "__main__":
|
40
55
|
try:
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
logging.info("Pre-commit hook completed successfully")
|
56
|
+
log_debug("Hook started")
|
57
|
+
update_dates_cache()
|
58
|
+
log_debug("Hook completed")
|
45
59
|
except Exception as e:
|
46
|
-
|
60
|
+
log_debug(f"Hook error: {e}")
|
47
61
|
sys.exit(1)
|
48
62
|
|
49
63
|
def find_mkdocs_projects():
|
@@ -9,23 +9,22 @@ from pathlib import Path
|
|
9
9
|
|
10
10
|
def install_git_hooks():
|
11
11
|
try:
|
12
|
-
#
|
13
|
-
|
12
|
+
# 等待包安装完成后再获取路径
|
13
|
+
import site
|
14
|
+
import mkdocs_document_dates
|
14
15
|
|
15
|
-
#
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
# 获取实际安装路径
|
17
|
+
for site_dir in site.getsitepackages():
|
18
|
+
hooks_dir = Path(site_dir) / 'mkdocs_document_dates' / 'hooks'
|
19
|
+
if hooks_dir.exists():
|
20
|
+
break
|
21
|
+
else:
|
22
|
+
# 检查用户安装目录
|
23
|
+
hooks_dir = Path(site.getusersitepackages()) / 'mkdocs_document_dates' / 'hooks'
|
24
|
+
if not hooks_dir.exists():
|
25
|
+
print("Warning: Hooks directory not found")
|
26
|
+
return
|
21
27
|
|
22
|
-
install_dir = Path(result).parent # Path 自动处理不同系统的路径分隔符
|
23
|
-
hooks_dir = install_dir / 'hooks'
|
24
|
-
|
25
|
-
if not hooks_dir.exists():
|
26
|
-
print("Warning: Hooks directory not found")
|
27
|
-
return
|
28
|
-
|
29
28
|
# 跨平台设置文件权限
|
30
29
|
hook_path = hooks_dir / 'pre-commit'
|
31
30
|
if not hook_path.exists():
|
@@ -67,7 +66,7 @@ try:
|
|
67
66
|
except FileNotFoundError:
|
68
67
|
long_description = "A MkDocs plugin for displaying accurate document creation and last modification dates."
|
69
68
|
|
70
|
-
VERSION = '1.9.
|
69
|
+
VERSION = '1.9.2'
|
71
70
|
|
72
71
|
setup(
|
73
72
|
name="mkdocs-document-dates",
|
File without changes
|
File without changes
|
{mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/__init__.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/__init__.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/ar.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/de.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/en.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/es.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/fr.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/ja.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/ko.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/ru.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/zh.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/zh_tw.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|