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.
Files changed (26) hide show
  1. {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/PKG-INFO +1 -1
  2. {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/hooks/pre-commit +20 -6
  3. {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates.egg-info/PKG-INFO +1 -1
  4. {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/setup.py +15 -16
  5. {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/LICENSE +0 -0
  6. {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/README.md +0 -0
  7. {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/__init__.py +0 -0
  8. {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/__init__.py +0 -0
  9. {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/ar.py +0 -0
  10. {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/de.py +0 -0
  11. {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/en.py +0 -0
  12. {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/es.py +0 -0
  13. {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/fr.py +0 -0
  14. {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/ja.py +0 -0
  15. {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/ko.py +0 -0
  16. {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/ru.py +0 -0
  17. {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/zh.py +0 -0
  18. {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/lang/zh_tw.py +0 -0
  19. {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/plugin.py +0 -0
  20. {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates/styles.py +0 -0
  21. {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates.egg-info/SOURCES.txt +0 -0
  22. {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates.egg-info/dependency_links.txt +0 -0
  23. {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates.egg-info/entry_points.txt +0 -0
  24. {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates.egg-info/requires.txt +0 -0
  25. {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/mkdocs_document_dates.egg-info/top_level.txt +0 -0
  26. {mkdocs_document_dates-1.9.0 → mkdocs_document_dates-1.9.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: mkdocs-document-dates
3
- Version: 1.9.0
3
+ Version: 1.9.2
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
@@ -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
- if setup_logging():
42
- logging.info("Starting pre-commit hook...")
43
- update_dates_cache()
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
- print(f"Error in pre-commit hook: {e}", file=sys.stderr)
60
+ log_debug(f"Hook error: {e}")
47
61
  sys.exit(1)
48
62
 
49
63
  def find_mkdocs_projects():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: mkdocs-document-dates
3
- Version: 1.9.0
3
+ Version: 1.9.2
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,23 +9,22 @@ from pathlib import Path
9
9
 
10
10
  def install_git_hooks():
11
11
  try:
12
- # 获取当前执行的 Python 解释器路径
13
- python_path = sys.executable
12
+ # 等待包安装完成后再获取路径
13
+ import site
14
+ import mkdocs_document_dates
14
15
 
15
- # 获取包的安装路径(使用 -c 参数在所有平台都有效)
16
- result = subprocess.check_output(
17
- [python_path, '-c', 'import mkdocs_document_dates; print(mkdocs_document_dates.__file__)'],
18
- text=True,
19
- shell=True if os.name == 'nt' else False # Windows 需要 shell=True
20
- ).strip()
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.0'
69
+ VERSION = '1.9.2'
71
70
 
72
71
  setup(
73
72
  name="mkdocs-document-dates",