mkdocs-document-dates 1.6.0__tar.gz → 1.7.0__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.6.0 → mkdocs_document_dates-1.7.0}/PKG-INFO +1 -1
  2. {mkdocs_document_dates-1.6.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/hooks/pre-commit +15 -3
  3. {mkdocs_document_dates-1.6.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates.egg-info/PKG-INFO +1 -1
  4. {mkdocs_document_dates-1.6.0 → mkdocs_document_dates-1.7.0}/setup.py +15 -13
  5. {mkdocs_document_dates-1.6.0 → mkdocs_document_dates-1.7.0}/LICENSE +0 -0
  6. {mkdocs_document_dates-1.6.0 → mkdocs_document_dates-1.7.0}/README.md +0 -0
  7. {mkdocs_document_dates-1.6.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/__init__.py +0 -0
  8. {mkdocs_document_dates-1.6.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/lang/__init__.py +0 -0
  9. {mkdocs_document_dates-1.6.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/lang/ar.py +0 -0
  10. {mkdocs_document_dates-1.6.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/lang/de.py +0 -0
  11. {mkdocs_document_dates-1.6.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/lang/en.py +0 -0
  12. {mkdocs_document_dates-1.6.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/lang/es.py +0 -0
  13. {mkdocs_document_dates-1.6.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/lang/fr.py +0 -0
  14. {mkdocs_document_dates-1.6.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/lang/ja.py +0 -0
  15. {mkdocs_document_dates-1.6.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/lang/ko.py +0 -0
  16. {mkdocs_document_dates-1.6.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/lang/ru.py +0 -0
  17. {mkdocs_document_dates-1.6.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/lang/zh.py +0 -0
  18. {mkdocs_document_dates-1.6.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/lang/zh_tw.py +0 -0
  19. {mkdocs_document_dates-1.6.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/plugin.py +0 -0
  20. {mkdocs_document_dates-1.6.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/styles.py +0 -0
  21. {mkdocs_document_dates-1.6.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates.egg-info/SOURCES.txt +0 -0
  22. {mkdocs_document_dates-1.6.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates.egg-info/dependency_links.txt +0 -0
  23. {mkdocs_document_dates-1.6.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates.egg-info/entry_points.txt +0 -0
  24. {mkdocs_document_dates-1.6.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates.egg-info/requires.txt +0 -0
  25. {mkdocs_document_dates-1.6.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates.egg-info/top_level.txt +0 -0
  26. {mkdocs_document_dates-1.6.0 → mkdocs_document_dates-1.7.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: mkdocs-document-dates
3
- Version: 1.6.0
3
+ Version: 1.7.0
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
@@ -54,6 +54,10 @@ def update_dates_cache():
54
54
  if not docs_dir.exists():
55
55
  continue
56
56
 
57
+ # 添加调试信息
58
+ print(f"Processing MkDocs project: {project_dir}")
59
+ print(f"Docs directory: {docs_dir}")
60
+
57
61
  dates_cache = {}
58
62
  # 获取所有 markdown 文件的时间信息
59
63
  for md_file in docs_dir.rglob("*.md"):
@@ -63,17 +67,25 @@ def update_dates_cache():
63
67
  "created": created,
64
68
  "modified": modified
65
69
  }
70
+ print(f"Processing file: {rel_path}")
66
71
 
67
72
  # 保存缓存文件
68
73
  cache_file = docs_dir / '.dates_cache.json'
74
+ print(f"Saving cache to: {cache_file}")
69
75
  with open(cache_file, "w") as f:
70
76
  json.dump(dates_cache, f, indent=2, ensure_ascii=False)
71
- subprocess.run(["git", "add", str(cache_file)], check=True)
72
-
77
+
78
+ try:
79
+ subprocess.run(["git", "add", str(cache_file)], check=True)
80
+ print(f"Added cache file to git: {cache_file}")
81
+ except subprocess.CalledProcessError as e:
82
+ print(f"Error adding cache file to git: {e}")
73
83
 
74
84
  if __name__ == "__main__":
75
85
  try:
86
+ print("Starting pre-commit hook...")
76
87
  update_dates_cache()
88
+ print("Pre-commit hook completed successfully")
77
89
  except Exception as e:
78
- print(f"Error updating dates cache: {e}", file=sys.stderr)
90
+ print(f"Error in pre-commit hook: {e}", file=sys.stderr)
79
91
  sys.exit(1)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: mkdocs-document-dates
3
- Version: 1.6.0
3
+ Version: 1.7.0
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
@@ -12,33 +12,35 @@ def install_git_hooks():
12
12
  # 获取当前执行的 Python 解释器路径
13
13
  python_path = sys.executable
14
14
 
15
- # 获取包的安装路径
15
+ # 获取包的安装路径(使用 -c 参数在所有平台都有效)
16
16
  result = subprocess.check_output(
17
17
  [python_path, '-c', 'import mkdocs_document_dates; print(mkdocs_document_dates.__file__)'],
18
- text=True
18
+ text=True,
19
+ shell=True if os.name == 'nt' else False # Windows 需要 shell=True
19
20
  ).strip()
20
21
 
21
- install_dir = Path(result).parent
22
+ install_dir = Path(result).parent # Path 自动处理不同系统的路径分隔符
22
23
  hooks_dir = install_dir / 'hooks'
23
24
 
24
25
  if not hooks_dir.exists():
25
26
  print("Warning: Hooks directory not found")
26
27
  return
27
28
 
28
- # 确保 hooks 目录存在且有执行权限
29
- subprocess.run(['chmod', '-R', '755', str(hooks_dir)], check=True)
30
-
31
- # 设置全局 hooks 路径
32
- subprocess.run(['git', 'config', '--global', 'core.hooksPath', str(hooks_dir)],
33
- check=True)
34
-
35
- # 验证 hook 是否正确安装
29
+ # 跨平台设置文件权限
36
30
  hook_path = hooks_dir / 'pre-commit'
37
31
  if not hook_path.exists():
38
32
  print("Warning: pre-commit hook not found")
39
33
  return
40
34
 
41
- os.chmod(hook_path, 0o755)
35
+ # 使用 os.chmod 代替 chmod 命令
36
+ if os.name != 'nt': # 非 Windows 系统才设置权限
37
+ os.chmod(hooks_dir, 0o755)
38
+ os.chmod(hook_path, 0o755)
39
+
40
+ # 设置全局 hooks 路径(git 命令在所有平台都一样)
41
+ subprocess.run(['git', 'config', '--global', 'core.hooksPath', str(hooks_dir)],
42
+ check=True)
43
+
42
44
  print(f"Git hooks installed successfully at: {hooks_dir}")
43
45
 
44
46
  except Exception as e:
@@ -65,7 +67,7 @@ try:
65
67
  except FileNotFoundError:
66
68
  long_description = "A MkDocs plugin for displaying accurate document creation and last modification dates."
67
69
 
68
- VERSION = '1.6.0'
70
+ VERSION = '1.7.0'
69
71
 
70
72
  setup(
71
73
  name="mkdocs-document-dates",