py2docfx 0.1.10.dev1871296__py3-none-any.whl → 0.1.10.dev1871906__py3-none-any.whl
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.
- py2docfx/__main__.py +11 -16
- py2docfx/convert_prepare/environment.py +25 -3
- {py2docfx-0.1.10.dev1871296.dist-info → py2docfx-0.1.10.dev1871906.dist-info}/METADATA +1 -1
- {py2docfx-0.1.10.dev1871296.dist-info → py2docfx-0.1.10.dev1871906.dist-info}/RECORD +6 -6
- {py2docfx-0.1.10.dev1871296.dist-info → py2docfx-0.1.10.dev1871906.dist-info}/WHEEL +0 -0
- {py2docfx-0.1.10.dev1871296.dist-info → py2docfx-0.1.10.dev1871906.dist-info}/top_level.txt +0 -0
py2docfx/__main__.py
CHANGED
@@ -248,9 +248,9 @@ async def donwload_package_generate_documents(
|
|
248
248
|
env_remove_tasks = []
|
249
249
|
|
250
250
|
start_time = time.time()
|
251
|
-
|
252
|
-
|
253
|
-
|
251
|
+
await py2docfxEnvironment.prepare_venv(0, required_package_list, github_token, ado_token)
|
252
|
+
for idx in range(1, min([py2docfxEnvironment.VENV_BUFFER, len(package_info_list)])):
|
253
|
+
env_prepare_tasks.append(asyncio.create_task(py2docfxEnvironment.copy_venv(0, idx)))
|
254
254
|
end_time = time.time()
|
255
255
|
print(f"<warmup_venvs>{end_time-start_time}<warmup_venvs/>")
|
256
256
|
|
@@ -258,11 +258,12 @@ async def donwload_package_generate_documents(
|
|
258
258
|
package_number = start_num + idx
|
259
259
|
print(f"Processing package {package.name}, env_prepare_tasks: {len(env_prepare_tasks)}")
|
260
260
|
start_time = time.time()
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
261
|
+
if idx >= 1:
|
262
|
+
try:
|
263
|
+
await env_prepare_tasks[idx-1]
|
264
|
+
except Exception as e:
|
265
|
+
print(f"Failed to setup venv for package {package.name}: {e}")
|
266
|
+
raise
|
266
267
|
end_time = time.time()
|
267
268
|
print(f"<wait_prepare_venv>{package.name},{end_time-start_time}<wait_prepare_venv/>")
|
268
269
|
|
@@ -305,16 +306,10 @@ async def donwload_package_generate_documents(
|
|
305
306
|
if idx + py2docfxEnvironment.VENV_BUFFER < len(package_info_list):
|
306
307
|
print(f"Creating venv {idx + py2docfxEnvironment.VENV_BUFFER}")
|
307
308
|
env_prepare_tasks.append(
|
308
|
-
asyncio.create_task(
|
309
|
-
py2docfxEnvironment.prepare_venv(
|
310
|
-
idx + py2docfxEnvironment.VENV_BUFFER,
|
311
|
-
required_package_list,
|
312
|
-
github_token,
|
313
|
-
ado_token)
|
314
|
-
)
|
315
|
-
)
|
309
|
+
asyncio.create_task(py2docfxEnvironment.copy_venv(0, idx + py2docfxEnvironment.VENV_BUFFER)))
|
316
310
|
end_time = time.time()
|
317
311
|
print(f"<create_prepare_venv>{package.name},{end_time-start_time}<create_prepare_venv/>")
|
312
|
+
# TODO: remove the last venv
|
318
313
|
if idx >= 1:
|
319
314
|
start_time = time.time()
|
320
315
|
env_remove_tasks.append(asyncio.create_task(
|
@@ -2,6 +2,7 @@ import subprocess
|
|
2
2
|
import asyncio
|
3
3
|
import os
|
4
4
|
import shutil
|
5
|
+
import platform
|
5
6
|
from py2docfx import PACKAGE_ROOT
|
6
7
|
from py2docfx.convert_prepare.package_info import PackageInfo
|
7
8
|
from py2docfx.convert_prepare.get_source import get_source
|
@@ -9,7 +10,7 @@ from py2docfx.convert_prepare import pip_utils
|
|
9
10
|
|
10
11
|
REQUIREMENT_MODULES = ["setuptools", "sphinx==6.1.3", "pyyaml", "jinja2==3.0.3", "wheel"]
|
11
12
|
VENV_DIR = "venv"
|
12
|
-
VENV_BUFFER =
|
13
|
+
VENV_BUFFER = 5
|
13
14
|
VENV_DELETE_BUFFER = 10
|
14
15
|
PIP_INSTALL_COMMAND = ["-m", "pip", "install", "--upgrade"]
|
15
16
|
|
@@ -73,16 +74,37 @@ async def prepare_venv(venv_num: int, required_package_list: list[PackageInfo],
|
|
73
74
|
await install_required_packages(get_venv_exe(venv_num), required_package_list, github_token, ado_token)
|
74
75
|
print(f"<CI INFO>: venv{venv_num} setup complete.")
|
75
76
|
|
77
|
+
async def copy_venv(venv_num: int, new_venv_num: int):
|
78
|
+
print(f"<CI INFO>: Copying venv{venv_num} to venv{new_venv_num}...")
|
79
|
+
venv_path = get_venv_path(venv_num)
|
80
|
+
new_venv_path = get_venv_path(new_venv_num)
|
81
|
+
if os.path.exists(venv_path):
|
82
|
+
if os.name == 'nt':
|
83
|
+
command = f'xcopy /E /I "{venv_path}" "{new_venv_path}"'
|
84
|
+
else:
|
85
|
+
command = f'cp -r "{venv_path}" "{new_venv_path}"'
|
86
|
+
|
87
|
+
process = await asyncio.create_subprocess_shell(
|
88
|
+
command,
|
89
|
+
stdout=asyncio.subprocess.PIPE,
|
90
|
+
stderr=asyncio.subprocess.PIPE
|
91
|
+
)
|
92
|
+
stdout, stderr = await process.communicate()
|
93
|
+
if process.returncode == 0:
|
94
|
+
print(f"<CI INFO>: venv{venv_num} copied to venv{new_venv_num}.")
|
95
|
+
else:
|
96
|
+
print(f"<CI ERROR>: Failed to copy venv{venv_num} to venv{new_venv_num}. Error: {stderr.decode()}")
|
97
|
+
|
76
98
|
async def remove_environment(venv_num: int):
|
77
99
|
venv_path = get_venv_path(venv_num)
|
78
100
|
if os.path.exists(venv_path):
|
79
101
|
print(f"<CI INFO>: Removing venv{venv_num}...")
|
80
102
|
# Create a subprocess to run the shell command for removing the directory
|
81
|
-
process = await
|
103
|
+
process = await asyncio.create_subprocess_shell(
|
82
104
|
f'rm -rf {venv_path}' if os.name != 'nt' else f'rmdir /S /Q {venv_path}',
|
83
105
|
stdout=asyncio.subprocess.PIPE,
|
84
106
|
stderr=asyncio.subprocess.PIPE
|
85
|
-
)
|
107
|
+
)
|
86
108
|
stdout, stderr = await process.communicate()
|
87
109
|
if process.returncode == 0:
|
88
110
|
print(f"<CI INFO>: venv{venv_num} removed.")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: py2docfx
|
3
|
-
Version: 0.1.10.
|
3
|
+
Version: 0.1.10.dev1871906
|
4
4
|
Summary: A package built based on Sphinx which download source code package and generate yaml files supported by docfx.
|
5
5
|
Author: Microsoft Corporation
|
6
6
|
License: MIT License
|
@@ -1,7 +1,7 @@
|
|
1
1
|
py2docfx/__init__.py,sha256=kPRhPGPC1JknDotkksG428c1iIgfFr_4_7Jm-llrowY,72
|
2
|
-
py2docfx/__main__.py,sha256=
|
2
|
+
py2docfx/__main__.py,sha256=OTRwbR7oc0RRg4xrUTe5SIvG00WX1c63O5ZHDTJPf0I,16466
|
3
3
|
py2docfx/convert_prepare/__init__.py,sha256=XxtxrP0kmW3ZBHIAoxsPDEHzcgeC0WSnole8Lk6CjKs,11
|
4
|
-
py2docfx/convert_prepare/environment.py,sha256=
|
4
|
+
py2docfx/convert_prepare/environment.py,sha256=F_2YRI7ljMoJ4aZuT0UmceRd7qyfLWRTXq8mbhPUI34,5065
|
5
5
|
py2docfx/convert_prepare/generate_conf.py,sha256=wqs6iyElzJarH-20_qEL9zvZvt5xfBMsGXSXPSZy6wg,2295
|
6
6
|
py2docfx/convert_prepare/generate_document.py,sha256=cLfFr7od0RHADkXyh2gaPreXZGvKNBUlduBosYTuPbk,3118
|
7
7
|
py2docfx/convert_prepare/get_source.py,sha256=hvWR_yPlfliLI9wywtnimKpjhJkx-LUYD6adGHgYTFA,5899
|
@@ -1882,7 +1882,7 @@ py2docfx/venv/venv0/Scripts/rst2s5.py,sha256=lnv7lRNv1Oz3gjI5BOJlTqfCJQLJxgwJ9l3
|
|
1882
1882
|
py2docfx/venv/venv0/Scripts/rst2xetex.py,sha256=5_9VjwA5RKUMJG9L__1ZiS8DIeLHRdPWeWW7B4otM8M,909
|
1883
1883
|
py2docfx/venv/venv0/Scripts/rst2xml.py,sha256=hU2nzGVbXbQBnH_ydI5f2VDkGQyDMUdTgz3rfa45JMg,638
|
1884
1884
|
py2docfx/venv/venv0/Scripts/rstpep2html.py,sha256=uLmCJKfEKPeeWS0n76HharN9YEYIuCRQQXfPPBJaRso,706
|
1885
|
-
py2docfx-0.1.10.
|
1886
|
-
py2docfx-0.1.10.
|
1887
|
-
py2docfx-0.1.10.
|
1888
|
-
py2docfx-0.1.10.
|
1885
|
+
py2docfx-0.1.10.dev1871906.dist-info/METADATA,sha256=2YF3fc3dxMD1CGCpbi-0EJibiq7hvI9JXX1VWw-pVCU,601
|
1886
|
+
py2docfx-0.1.10.dev1871906.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
1887
|
+
py2docfx-0.1.10.dev1871906.dist-info/top_level.txt,sha256=5dH2uP81dczt_qQJ38wiZ-gzoVWasfiJALWRSjdbnYU,9
|
1888
|
+
py2docfx-0.1.10.dev1871906.dist-info/RECORD,,
|
File without changes
|
File without changes
|