mkdocs-document-dates 1.9.2__tar.gz → 1.9.4__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.2 → mkdocs_document_dates-1.9.4}/PKG-INFO +1 -1
- {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/hooks/pre-commit +25 -3
- {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates.egg-info/PKG-INFO +1 -1
- {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/setup.py +37 -30
- {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/LICENSE +0 -0
- {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/README.md +0 -0
- {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/__init__.py +0 -0
- {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/__init__.py +0 -0
- {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/ar.py +0 -0
- {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/de.py +0 -0
- {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/en.py +0 -0
- {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/es.py +0 -0
- {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/fr.py +0 -0
- {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/ja.py +0 -0
- {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/ko.py +0 -0
- {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/ru.py +0 -0
- {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/zh.py +0 -0
- {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/zh_tw.py +0 -0
- {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/plugin.py +0 -0
- {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/styles.py +0 -0
- {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates.egg-info/SOURCES.txt +0 -0
- {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates.egg-info/dependency_links.txt +0 -0
- {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates.egg-info/entry_points.txt +0 -0
- {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates.egg-info/requires.txt +0 -0
- {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates.egg-info/top_level.txt +0 -0
- {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/setup.cfg +0 -0
{mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/hooks/pre-commit
RENAMED
@@ -51,13 +51,35 @@ def setup_logging():
|
|
51
51
|
print(f"Failed to setup logging: {e}", file=sys.stderr)
|
52
52
|
return False
|
53
53
|
|
54
|
+
# 添加调试函数
|
55
|
+
def debug_info():
|
56
|
+
info = {
|
57
|
+
'cwd': os.getcwd(),
|
58
|
+
'python_path': sys.executable,
|
59
|
+
'env_path': os.environ.get('PATH', ''),
|
60
|
+
'script_path': __file__,
|
61
|
+
'timestamp': datetime.now().isoformat()
|
62
|
+
}
|
63
|
+
|
64
|
+
# 保存调试信息到固定位置
|
65
|
+
debug_file = Path('/tmp/mkdocs_hook_debug.json')
|
66
|
+
try:
|
67
|
+
with open(debug_file, 'w') as f:
|
68
|
+
json.dump(info, f, indent=2)
|
69
|
+
|
70
|
+
# 同时输出到 stderr(git 会显示这些信息)
|
71
|
+
print("Hook debug info:", file=sys.stderr)
|
72
|
+
for k, v in info.items():
|
73
|
+
print(f"{k}: {v}", file=sys.stderr)
|
74
|
+
except Exception as e:
|
75
|
+
print(f"Debug error: {e}", file=sys.stderr)
|
76
|
+
|
54
77
|
if __name__ == "__main__":
|
55
78
|
try:
|
56
|
-
|
79
|
+
debug_info() # 添加调试信息
|
57
80
|
update_dates_cache()
|
58
|
-
log_debug("Hook completed")
|
59
81
|
except Exception as e:
|
60
|
-
|
82
|
+
print(f"Hook error: {e}", file=sys.stderr)
|
61
83
|
sys.exit(1)
|
62
84
|
|
63
85
|
def find_mkdocs_projects():
|
@@ -9,38 +9,45 @@ from pathlib import Path
|
|
9
9
|
|
10
10
|
def install_git_hooks():
|
11
11
|
try:
|
12
|
-
#
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
12
|
+
# 创建一个安装脚本
|
13
|
+
install_script = """
|
14
|
+
#!/usr/bin/env python3
|
15
|
+
import site
|
16
|
+
import os
|
17
|
+
from pathlib import Path
|
18
|
+
|
19
|
+
def setup_hooks():
|
20
|
+
# 查找 hooks 目录
|
21
|
+
for site_dir in site.getsitepackages():
|
22
|
+
hooks_dir = Path(site_dir) / 'mkdocs_document_dates' / 'hooks'
|
23
|
+
if hooks_dir.exists():
|
24
|
+
hook_path = hooks_dir / 'pre-commit'
|
25
|
+
if hook_path.exists():
|
26
|
+
# 设置权限
|
27
|
+
if os.name != 'nt':
|
28
|
+
os.chmod(hooks_dir, 0o755)
|
29
|
+
os.chmod(hook_path, 0o755)
|
30
|
+
# 设置 git hooks 路径
|
31
|
+
os.system(f'git config --global core.hooksPath "{hooks_dir}"')
|
32
|
+
print(f"Git hooks installed at: {hooks_dir}")
|
26
33
|
return
|
34
|
+
print("Warning: Hooks directory not found")
|
35
|
+
|
36
|
+
if __name__ == "__main__":
|
37
|
+
setup_hooks()
|
38
|
+
"""
|
39
|
+
# 创建安装脚本
|
40
|
+
script_dir = Path.home() / '.mkdocs_document_dates'
|
41
|
+
script_dir.mkdir(exist_ok=True)
|
42
|
+
script_path = script_dir / 'setup_hooks.py'
|
43
|
+
script_path.write_text(install_script)
|
27
44
|
|
28
|
-
#
|
29
|
-
|
30
|
-
|
31
|
-
print("Warning: pre-commit hook not found")
|
32
|
-
return
|
33
|
-
|
34
|
-
# 使用 os.chmod 代替 chmod 命令
|
35
|
-
if os.name != 'nt': # 非 Windows 系统才设置权限
|
36
|
-
os.chmod(hooks_dir, 0o755)
|
37
|
-
os.chmod(hook_path, 0o755)
|
38
|
-
|
39
|
-
# 设置全局 hooks 路径(git 命令在所有平台都一样)
|
40
|
-
subprocess.run(['git', 'config', '--global', 'core.hooksPath', str(hooks_dir)],
|
41
|
-
check=True)
|
45
|
+
# 设置脚本权限
|
46
|
+
if os.name != 'nt':
|
47
|
+
os.chmod(script_path, 0o755)
|
42
48
|
|
43
|
-
|
49
|
+
# 执行脚本
|
50
|
+
subprocess.run([sys.executable, str(script_path)], check=True)
|
44
51
|
|
45
52
|
except Exception as e:
|
46
53
|
print(f"Warning: Failed to install git hooks: {e}")
|
@@ -66,7 +73,7 @@ try:
|
|
66
73
|
except FileNotFoundError:
|
67
74
|
long_description = "A MkDocs plugin for displaying accurate document creation and last modification dates."
|
68
75
|
|
69
|
-
VERSION = '1.9.
|
76
|
+
VERSION = '1.9.4'
|
70
77
|
|
71
78
|
setup(
|
72
79
|
name="mkdocs-document-dates",
|
File without changes
|
File without changes
|
{mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/__init__.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/__init__.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/ar.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/de.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/en.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/es.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/fr.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/ja.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/ko.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/ru.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/zh.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/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
|