mkdocs-document-dates 1.5.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.5.0 → mkdocs_document_dates-1.7.0}/PKG-INFO +1 -1
  2. {mkdocs_document_dates-1.5.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/hooks/pre-commit +15 -3
  3. {mkdocs_document_dates-1.5.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates.egg-info/PKG-INFO +1 -1
  4. {mkdocs_document_dates-1.5.0 → mkdocs_document_dates-1.7.0}/setup.py +23 -13
  5. {mkdocs_document_dates-1.5.0 → mkdocs_document_dates-1.7.0}/LICENSE +0 -0
  6. {mkdocs_document_dates-1.5.0 → mkdocs_document_dates-1.7.0}/README.md +0 -0
  7. {mkdocs_document_dates-1.5.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/__init__.py +0 -0
  8. {mkdocs_document_dates-1.5.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/lang/__init__.py +0 -0
  9. {mkdocs_document_dates-1.5.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/lang/ar.py +0 -0
  10. {mkdocs_document_dates-1.5.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/lang/de.py +0 -0
  11. {mkdocs_document_dates-1.5.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/lang/en.py +0 -0
  12. {mkdocs_document_dates-1.5.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/lang/es.py +0 -0
  13. {mkdocs_document_dates-1.5.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/lang/fr.py +0 -0
  14. {mkdocs_document_dates-1.5.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/lang/ja.py +0 -0
  15. {mkdocs_document_dates-1.5.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/lang/ko.py +0 -0
  16. {mkdocs_document_dates-1.5.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/lang/ru.py +0 -0
  17. {mkdocs_document_dates-1.5.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/lang/zh.py +0 -0
  18. {mkdocs_document_dates-1.5.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/lang/zh_tw.py +0 -0
  19. {mkdocs_document_dates-1.5.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/plugin.py +0 -0
  20. {mkdocs_document_dates-1.5.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates/styles.py +0 -0
  21. {mkdocs_document_dates-1.5.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates.egg-info/SOURCES.txt +0 -0
  22. {mkdocs_document_dates-1.5.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates.egg-info/dependency_links.txt +0 -0
  23. {mkdocs_document_dates-1.5.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates.egg-info/entry_points.txt +0 -0
  24. {mkdocs_document_dates-1.5.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates.egg-info/requires.txt +0 -0
  25. {mkdocs_document_dates-1.5.0 → mkdocs_document_dates-1.7.0}/mkdocs_document_dates.egg-info/top_level.txt +0 -0
  26. {mkdocs_document_dates-1.5.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.5.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.5.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
@@ -3,34 +3,44 @@ from setuptools.command.install import install
3
3
  from setuptools.command.develop import develop
4
4
  from setuptools.command.build_py import build_py
5
5
  import os
6
+ import sys
6
7
  import subprocess
7
8
  from pathlib import Path
8
9
 
9
10
  def install_git_hooks():
10
11
  try:
11
- # 获取包的安装路径
12
- import mkdocs_document_dates
13
- install_dir = Path(mkdocs_document_dates.__file__).parent
12
+ # 获取当前执行的 Python 解释器路径
13
+ python_path = sys.executable
14
+
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()
21
+
22
+ install_dir = Path(result).parent # Path 自动处理不同系统的路径分隔符
14
23
  hooks_dir = install_dir / 'hooks'
15
24
 
16
25
  if not hooks_dir.exists():
17
26
  print("Warning: Hooks directory not found")
18
27
  return
19
28
 
20
- # 确保 hooks 目录存在且有执行权限
21
- subprocess.run(['chmod', '-R', '755', str(hooks_dir)], check=True)
22
-
23
- # 设置全局 hooks 路径
24
- subprocess.run(['git', 'config', '--global', 'core.hooksPath', str(hooks_dir)],
25
- check=True)
26
-
27
- # 验证 hook 是否正确安装
29
+ # 跨平台设置文件权限
28
30
  hook_path = hooks_dir / 'pre-commit'
29
31
  if not hook_path.exists():
30
32
  print("Warning: pre-commit hook not found")
31
33
  return
32
34
 
33
- 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
+
34
44
  print(f"Git hooks installed successfully at: {hooks_dir}")
35
45
 
36
46
  except Exception as e:
@@ -57,7 +67,7 @@ try:
57
67
  except FileNotFoundError:
58
68
  long_description = "A MkDocs plugin for displaying accurate document creation and last modification dates."
59
69
 
60
- VERSION = '1.5.0'
70
+ VERSION = '1.7.0'
61
71
 
62
72
  setup(
63
73
  name="mkdocs-document-dates",