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.
Files changed (26) hide show
  1. {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/PKG-INFO +1 -1
  2. {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/hooks/pre-commit +25 -3
  3. {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates.egg-info/PKG-INFO +1 -1
  4. {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/setup.py +37 -30
  5. {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/LICENSE +0 -0
  6. {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/README.md +0 -0
  7. {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/__init__.py +0 -0
  8. {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/__init__.py +0 -0
  9. {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/ar.py +0 -0
  10. {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/de.py +0 -0
  11. {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/en.py +0 -0
  12. {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/es.py +0 -0
  13. {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/fr.py +0 -0
  14. {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/ja.py +0 -0
  15. {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/ko.py +0 -0
  16. {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/ru.py +0 -0
  17. {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/zh.py +0 -0
  18. {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/lang/zh_tw.py +0 -0
  19. {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/plugin.py +0 -0
  20. {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates/styles.py +0 -0
  21. {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates.egg-info/SOURCES.txt +0 -0
  22. {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates.egg-info/dependency_links.txt +0 -0
  23. {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates.egg-info/entry_points.txt +0 -0
  24. {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates.egg-info/requires.txt +0 -0
  25. {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/mkdocs_document_dates.egg-info/top_level.txt +0 -0
  26. {mkdocs_document_dates-1.9.2 → mkdocs_document_dates-1.9.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: mkdocs-document-dates
3
- Version: 1.9.2
3
+ Version: 1.9.4
4
4
  Summary: A MkDocs plugin for displaying accurate document creation and last modification dates.
5
5
  Home-page: https://github.com/jaywhj/mkdocs-document-dates
6
6
  Author: Aaron Wang
@@ -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
- log_debug("Hook started")
79
+ debug_info() # 添加调试信息
57
80
  update_dates_cache()
58
- log_debug("Hook completed")
59
81
  except Exception as e:
60
- log_debug(f"Hook error: {e}")
82
+ print(f"Hook error: {e}", file=sys.stderr)
61
83
  sys.exit(1)
62
84
 
63
85
  def find_mkdocs_projects():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: mkdocs-document-dates
3
- Version: 1.9.2
3
+ Version: 1.9.4
4
4
  Summary: A MkDocs plugin for displaying accurate document creation and last modification dates.
5
5
  Home-page: https://github.com/jaywhj/mkdocs-document-dates
6
6
  Author: Aaron Wang
@@ -9,38 +9,45 @@ from pathlib import Path
9
9
 
10
10
  def install_git_hooks():
11
11
  try:
12
- # 等待包安装完成后再获取路径
13
- import site
14
- import mkdocs_document_dates
15
-
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")
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
- hook_path = hooks_dir / 'pre-commit'
30
- if not hook_path.exists():
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
- print(f"Git hooks installed successfully at: {hooks_dir}")
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.2'
76
+ VERSION = '1.9.4'
70
77
 
71
78
  setup(
72
79
  name="mkdocs-document-dates",