mkdocs-document-dates 1.9.5__tar.gz → 1.9.7__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.5 → mkdocs_document_dates-1.9.7}/PKG-INFO +1 -1
- {mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates.egg-info/PKG-INFO +1 -1
- mkdocs_document_dates-1.9.7/setup.py +108 -0
- mkdocs_document_dates-1.9.5/setup.py +0 -137
- {mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/LICENSE +0 -0
- {mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/README.md +0 -0
- {mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates/__init__.py +0 -0
- {mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates/hooks/pre-commit +0 -0
- {mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates/lang/__init__.py +0 -0
- {mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates/lang/ar.py +0 -0
- {mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates/lang/de.py +0 -0
- {mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates/lang/en.py +0 -0
- {mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates/lang/es.py +0 -0
- {mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates/lang/fr.py +0 -0
- {mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates/lang/ja.py +0 -0
- {mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates/lang/ko.py +0 -0
- {mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates/lang/ru.py +0 -0
- {mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates/lang/zh.py +0 -0
- {mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates/lang/zh_tw.py +0 -0
- {mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates/plugin.py +0 -0
- {mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates/styles.py +0 -0
- {mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates.egg-info/SOURCES.txt +0 -0
- {mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates.egg-info/dependency_links.txt +0 -0
- {mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates.egg-info/entry_points.txt +0 -0
- {mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates.egg-info/requires.txt +0 -0
- {mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates.egg-info/top_level.txt +0 -0
- {mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/setup.cfg +0 -0
@@ -0,0 +1,108 @@
|
|
1
|
+
from setuptools import setup, find_packages
|
2
|
+
from setuptools.command.install import install
|
3
|
+
from setuptools.command.develop import develop
|
4
|
+
from setuptools.command.build_py import build_py
|
5
|
+
import os
|
6
|
+
import sys
|
7
|
+
import subprocess
|
8
|
+
from pathlib import Path
|
9
|
+
|
10
|
+
def install_git_hooks():
|
11
|
+
try:
|
12
|
+
# 先等待包安装完成并打印调试信息
|
13
|
+
print("Starting hooks installation...")
|
14
|
+
|
15
|
+
# 使用 pkg_resources 获取已安装包的位置
|
16
|
+
import pkg_resources
|
17
|
+
dist = pkg_resources.get_distribution('mkdocs-document-dates')
|
18
|
+
hooks_dir = Path(dist.location) / 'mkdocs_document_dates' / 'hooks'
|
19
|
+
|
20
|
+
print(f"Looking for hooks in: {hooks_dir}")
|
21
|
+
|
22
|
+
if not hooks_dir.exists():
|
23
|
+
print(f"Error: Hooks directory not found at {hooks_dir}")
|
24
|
+
return
|
25
|
+
|
26
|
+
hook_path = hooks_dir / 'pre-commit'
|
27
|
+
if not hook_path.exists():
|
28
|
+
print(f"Error: pre-commit hook not found at {hook_path}")
|
29
|
+
return
|
30
|
+
|
31
|
+
# 设置权限
|
32
|
+
if os.name != 'nt':
|
33
|
+
print(f"Setting permissions for {hooks_dir}")
|
34
|
+
os.chmod(hooks_dir, 0o755)
|
35
|
+
os.chmod(hook_path, 0o755)
|
36
|
+
|
37
|
+
# 设置 git hooks 路径
|
38
|
+
print(f"Configuring git hooks path to: {hooks_dir}")
|
39
|
+
result = subprocess.run(['git', 'config', '--global', 'core.hooksPath', str(hooks_dir)],
|
40
|
+
capture_output=True,
|
41
|
+
text=True)
|
42
|
+
|
43
|
+
if result.returncode != 0:
|
44
|
+
print(f"Error setting git hooks path: {result.stderr}")
|
45
|
+
return
|
46
|
+
|
47
|
+
print(f"Git hooks installed successfully at: {hooks_dir}")
|
48
|
+
|
49
|
+
except Exception as e:
|
50
|
+
print(f"Error installing git hooks: {e}")
|
51
|
+
import traceback
|
52
|
+
print(traceback.format_exc())
|
53
|
+
|
54
|
+
class CustomInstall(install):
|
55
|
+
def run(self):
|
56
|
+
install.run(self)
|
57
|
+
install_git_hooks()
|
58
|
+
|
59
|
+
class CustomDevelop(develop):
|
60
|
+
def run(self):
|
61
|
+
develop.run(self)
|
62
|
+
install_git_hooks()
|
63
|
+
|
64
|
+
class CustomBuildPy(build_py):
|
65
|
+
def run(self):
|
66
|
+
build_py.run(self)
|
67
|
+
install_git_hooks()
|
68
|
+
|
69
|
+
try:
|
70
|
+
with open("README.md", "r", encoding="utf-8") as fh:
|
71
|
+
long_description = fh.read()
|
72
|
+
except FileNotFoundError:
|
73
|
+
long_description = "A MkDocs plugin for displaying accurate document creation and last modification dates."
|
74
|
+
|
75
|
+
VERSION = '1.9.7'
|
76
|
+
|
77
|
+
setup(
|
78
|
+
name="mkdocs-document-dates",
|
79
|
+
version=VERSION,
|
80
|
+
author="Aaron Wang",
|
81
|
+
description="A MkDocs plugin for displaying accurate document creation and last modification dates.",
|
82
|
+
long_description=long_description,
|
83
|
+
long_description_content_type="text/markdown",
|
84
|
+
url="https://github.com/jaywhj/mkdocs-document-dates",
|
85
|
+
packages=find_packages(),
|
86
|
+
install_requires=[
|
87
|
+
'mkdocs>=1.0.0',
|
88
|
+
],
|
89
|
+
classifiers=[
|
90
|
+
"Programming Language :: Python :: 3",
|
91
|
+
"License :: OSI Approved :: MIT License",
|
92
|
+
"Operating System :: OS Independent",
|
93
|
+
],
|
94
|
+
entry_points={
|
95
|
+
'mkdocs.plugins': [
|
96
|
+
'document-dates = mkdocs_document_dates.plugin:DocumentDatesPlugin',
|
97
|
+
]
|
98
|
+
},
|
99
|
+
cmdclass={
|
100
|
+
'install': CustomInstall,
|
101
|
+
'develop': CustomDevelop,
|
102
|
+
'build_py': CustomBuildPy,
|
103
|
+
},
|
104
|
+
package_data={
|
105
|
+
'mkdocs_document_dates': ['hooks/*'],
|
106
|
+
},
|
107
|
+
python_requires=">=3.6",
|
108
|
+
)
|
@@ -1,137 +0,0 @@
|
|
1
|
-
from setuptools import setup, find_packages
|
2
|
-
from setuptools.command.install import install
|
3
|
-
from setuptools.command.develop import develop
|
4
|
-
from setuptools.command.build_py import build_py
|
5
|
-
import os
|
6
|
-
import sys
|
7
|
-
import subprocess
|
8
|
-
from pathlib import Path
|
9
|
-
|
10
|
-
def install_git_hooks():
|
11
|
-
try:
|
12
|
-
# 先卸载旧的 hooks 配置
|
13
|
-
subprocess.run(['git', 'config', '--global', '--unset', 'core.hooksPath'],
|
14
|
-
check=False) # 忽略错误,因为可能本来就没有配置
|
15
|
-
|
16
|
-
# 等待包安装完成
|
17
|
-
subprocess.run([
|
18
|
-
sys.executable,
|
19
|
-
'-c',
|
20
|
-
'import time; time.sleep(2); import mkdocs_document_dates'
|
21
|
-
], check=True)
|
22
|
-
|
23
|
-
# 重新运行安装脚本
|
24
|
-
install_script = """
|
25
|
-
#!/usr/bin/env python3
|
26
|
-
import site
|
27
|
-
import os
|
28
|
-
import sys
|
29
|
-
from pathlib import Path
|
30
|
-
|
31
|
-
def setup_hooks():
|
32
|
-
# 先在系统路径中查找
|
33
|
-
for site_dir in site.getsitepackages():
|
34
|
-
hooks_dir = Path(site_dir) / 'mkdocs_document_dates' / 'hooks'
|
35
|
-
if hooks_dir.exists():
|
36
|
-
break
|
37
|
-
else:
|
38
|
-
# 再在用户路径中查找
|
39
|
-
hooks_dir = Path(site.getusersitepackages()) / 'mkdocs_document_dates' / 'hooks'
|
40
|
-
if not hooks_dir.exists():
|
41
|
-
print("Error: Hooks directory not found in", site.getsitepackages())
|
42
|
-
print("Error: Hooks directory not found in", site.getusersitepackages())
|
43
|
-
sys.exit(1)
|
44
|
-
|
45
|
-
hook_path = hooks_dir / 'pre-commit'
|
46
|
-
if not hook_path.exists():
|
47
|
-
print("Error: pre-commit hook not found in", hooks_dir)
|
48
|
-
sys.exit(1)
|
49
|
-
|
50
|
-
# 设置权限
|
51
|
-
if os.name != 'nt':
|
52
|
-
os.chmod(hooks_dir, 0o755)
|
53
|
-
os.chmod(hook_path, 0o755)
|
54
|
-
|
55
|
-
# 设置 git hooks 路径
|
56
|
-
result = os.system(f'git config --global core.hooksPath "{hooks_dir}"')
|
57
|
-
if result != 0:
|
58
|
-
print("Error: Failed to set git hooks path")
|
59
|
-
sys.exit(1)
|
60
|
-
|
61
|
-
print(f"Git hooks installed successfully at: {hooks_dir}")
|
62
|
-
return True
|
63
|
-
|
64
|
-
if __name__ == "__main__":
|
65
|
-
setup_hooks()
|
66
|
-
"""
|
67
|
-
# 创建安装脚本
|
68
|
-
script_dir = Path.home() / '.mkdocs_document_dates'
|
69
|
-
script_dir.mkdir(exist_ok=True)
|
70
|
-
script_path = script_dir / 'setup_hooks.py'
|
71
|
-
script_path.write_text(install_script)
|
72
|
-
|
73
|
-
# 设置脚本权限
|
74
|
-
if os.name != 'nt':
|
75
|
-
os.chmod(script_path, 0o755)
|
76
|
-
|
77
|
-
# 执行脚本
|
78
|
-
subprocess.run([sys.executable, str(script_path)], check=True)
|
79
|
-
|
80
|
-
except Exception as e:
|
81
|
-
print(f"Warning: Failed to install git hooks: {e}")
|
82
|
-
|
83
|
-
class CustomInstall(install):
|
84
|
-
def run(self):
|
85
|
-
install.run(self)
|
86
|
-
install_git_hooks()
|
87
|
-
|
88
|
-
class CustomDevelop(develop):
|
89
|
-
def run(self):
|
90
|
-
develop.run(self)
|
91
|
-
install_git_hooks()
|
92
|
-
|
93
|
-
class CustomBuildPy(build_py):
|
94
|
-
def run(self):
|
95
|
-
build_py.run(self)
|
96
|
-
install_git_hooks()
|
97
|
-
|
98
|
-
try:
|
99
|
-
with open("README.md", "r", encoding="utf-8") as fh:
|
100
|
-
long_description = fh.read()
|
101
|
-
except FileNotFoundError:
|
102
|
-
long_description = "A MkDocs plugin for displaying accurate document creation and last modification dates."
|
103
|
-
|
104
|
-
VERSION = '1.9.5'
|
105
|
-
|
106
|
-
setup(
|
107
|
-
name="mkdocs-document-dates",
|
108
|
-
version=VERSION,
|
109
|
-
author="Aaron Wang",
|
110
|
-
description="A MkDocs plugin for displaying accurate document creation and last modification dates.",
|
111
|
-
long_description=long_description,
|
112
|
-
long_description_content_type="text/markdown",
|
113
|
-
url="https://github.com/jaywhj/mkdocs-document-dates",
|
114
|
-
packages=find_packages(),
|
115
|
-
install_requires=[
|
116
|
-
'mkdocs>=1.0.0',
|
117
|
-
],
|
118
|
-
classifiers=[
|
119
|
-
"Programming Language :: Python :: 3",
|
120
|
-
"License :: OSI Approved :: MIT License",
|
121
|
-
"Operating System :: OS Independent",
|
122
|
-
],
|
123
|
-
entry_points={
|
124
|
-
'mkdocs.plugins': [
|
125
|
-
'document-dates = mkdocs_document_dates.plugin:DocumentDatesPlugin',
|
126
|
-
]
|
127
|
-
},
|
128
|
-
cmdclass={
|
129
|
-
'build_py': CustomBuildPy,
|
130
|
-
'install': CustomInstall,
|
131
|
-
'develop': CustomDevelop,
|
132
|
-
},
|
133
|
-
package_data={
|
134
|
-
'mkdocs_document_dates': ['hooks/*'],
|
135
|
-
},
|
136
|
-
python_requires=">=3.6",
|
137
|
-
)
|
File without changes
|
File without changes
|
{mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates/__init__.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates/hooks/pre-commit
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates/lang/__init__.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates/lang/ar.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates/lang/de.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates/lang/en.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates/lang/es.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates/lang/fr.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates/lang/ja.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates/lang/ko.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates/lang/ru.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/mkdocs_document_dates/lang/zh.py
RENAMED
File without changes
|
{mkdocs_document_dates-1.9.5 → mkdocs_document_dates-1.9.7}/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
|