py2docfx 0.1.19.dev2192444__py3-none-any.whl → 0.1.19.dev2192635__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 CHANGED
@@ -106,8 +106,8 @@ async def main(argv) -> int:
106
106
 
107
107
  # create log folder and package log folder
108
108
  log_folder = os.path.join(PACKAGE_ROOT, LOG_FOLDER)
109
- os.makedirs(log_folder, exist_ok=True)
110
- os.makedirs(os.path.join(log_folder, "package_logs"), exist_ok=True)
109
+ os.makedirs(log_folder)
110
+ os.makedirs(os.path.join(log_folder, "package_logs"))
111
111
 
112
112
  py2docfxLogger.decide_global_log_level(verbose, show_warning)
113
113
 
@@ -41,11 +41,10 @@ def update_package_info(executable: str, pkg: PackageInfo, source_folder: str):
41
41
 
42
42
  setattr(pkg, attr, attr_val)
43
43
  else:
44
- # Find .dist-info folders
45
- dist_info_folders = [f for f in all_files if path.isdir(f) and f.endswith(".dist-info")]
46
-
47
- if dist_info_folders:
48
- folder = dist_info_folders[0] # Take the first one if multiple exist
44
+ folder = next(
45
+ f for f in all_files if path.isdir(f) and f.endswith(".dist-info")
46
+ )
47
+ if folder:
49
48
  if path.exists(path.join(folder, "METADATA")):
50
49
  with open(
51
50
  path.join(folder, "METADATA"), "r", encoding="utf-8"
@@ -98,9 +97,6 @@ async def get_source(executable: str, pkg: PackageInfo, cnt: int, vststoken=None
98
97
  sys.path.insert(0, source_folder)
99
98
  elif pkg.install_type == PackageInfo.InstallType.PYPI:
100
99
  full_name = pkg.get_combined_name_version()
101
- # Ensure the dist directory exists
102
- os.makedirs(dist_dir, exist_ok=True)
103
-
104
100
  await pip_utils.download(
105
101
  full_name,
106
102
  dist_dir,
@@ -108,53 +104,25 @@ async def get_source(executable: str, pkg: PackageInfo, cnt: int, vststoken=None
108
104
  prefer_source_distribution=pkg.prefer_source_distribution,
109
105
  )
110
106
  # unpack the downloaded wheel file.
111
- dist_files = os.listdir(dist_dir)
112
- if not dist_files:
113
- msg = f"No files downloaded to {dist_dir} for package {pkg.name}"
114
- py2docfx_logger.error(msg)
115
- raise FileNotFoundError(f"No files found in {dist_dir}")
116
-
117
- downloaded_dist_file = path.join(dist_dir, dist_files[0])
107
+ downloaded_dist_file = path.join(dist_dir, os.listdir(dist_dir)[0])
118
108
  await pack.unpack_dist(pkg.name, downloaded_dist_file)
119
109
  os.remove(downloaded_dist_file)
120
- dist_files = os.listdir(dist_dir)
121
- if not dist_files:
122
- msg = f"No files found in {dist_dir} after unpacking for package {pkg.name}"
123
- py2docfx_logger.error(msg)
124
- raise FileNotFoundError(f"No files found in {dist_dir} after unpacking")
125
-
126
110
  source_folder = path.join(
127
111
  path.dirname(downloaded_dist_file),
128
- dist_files[0]
112
+ os.listdir(dist_dir)[0]
129
113
  )
130
114
  elif pkg.install_type == PackageInfo.InstallType.DIST_FILE:
131
- # Ensure the dist directory exists
132
- os.makedirs(dist_dir, exist_ok=True)
133
-
134
115
  await pip_utils.download(pkg.location, dist_dir, prefer_source_distribution=False)
135
116
  # unpack the downloaded dist file.
136
- dist_files = os.listdir(dist_dir)
137
- if not dist_files:
138
- msg = f"No files downloaded to {dist_dir} for package {pkg.name}"
139
- py2docfx_logger.error(msg)
140
- raise FileNotFoundError(f"No files found in {dist_dir}")
141
-
142
- downloaded_dist_file = path.join(dist_dir, dist_files[0])
117
+ downloaded_dist_file = path.join(dist_dir, os.listdir(dist_dir)[0])
143
118
  await pack.unpack_dist(pkg.name, downloaded_dist_file)
144
119
  os.remove(downloaded_dist_file)
145
-
146
- # Check again after unpacking
147
- dist_files = os.listdir(dist_dir)
148
- if not dist_files:
149
- msg = f"No files found in {dist_dir} after unpacking for package {pkg.name}"
150
- py2docfx_logger.error(msg)
151
- raise FileNotFoundError(f"No files found in {dist_dir} after unpacking")
152
120
  if downloaded_dist_file.endswith(".tar.gz"):
153
121
  downloaded_dist_file = downloaded_dist_file.rsplit(".", maxsplit=1)[
154
122
  0]
155
123
  source_folder = path.join(
156
124
  path.dirname(downloaded_dist_file),
157
- dist_files[0] if dist_files else ""
125
+ os.listdir(dist_dir)[0]
158
126
  )
159
127
  else:
160
128
  msg = f"Unknown install type: {pkg.install_type}"
@@ -25,7 +25,7 @@ async def clone(repo_location, branch, folder, extra_token=None):
25
25
  raise ValueError(msg)
26
26
  else:
27
27
  # Remove http(s):// from url to record. Further avoid dup-clone.
28
- pureURL = re.sub(r"^\s*https?://", "", repo_location)
28
+ pureURL = re.sub("^\s*https?://", "", repo_location)
29
29
 
30
30
  if pureURL not in repoMap:
31
31
  branch = convertBranch(repo_location, branch, extra_token)
@@ -77,18 +77,16 @@ def counts_errors_warnings(log_file_path):
77
77
  warning_count += 1
78
78
  return warning_count, error_count
79
79
 
80
- def get_warning_error_count():
81
- main_log_file_path = os.path.join("logs", "log.txt")
82
- warning_count, error_count = counts_errors_warnings(main_log_file_path)
83
-
84
- log_folder_path = os.path.join("logs", "package_logs")
85
- # Check if the directory exists before trying to list its contents
86
- if os.path.exists(log_folder_path) and os.path.isdir(log_folder_path):
87
- for log_file in os.listdir(log_folder_path):
88
- log_file_path = os.path.join(log_folder_path, log_file)
89
- warnings, errors = counts_errors_warnings(log_file_path)
90
- warning_count += warnings
91
- error_count += errors
80
+ def get_warning_error_count():
81
+ main_log_file_path = os.path.join("logs", "log.txt")
82
+ warning_count, error_count = counts_errors_warnings(main_log_file_path)
83
+
84
+ log_folder_path = os.path.join("logs", "package_logs")
85
+ for log_file in os.listdir(log_folder_path):
86
+ log_file_path = os.path.join(log_folder_path, log_file)
87
+ warnings, errors = counts_errors_warnings(log_file_path)
88
+ warning_count += warnings
89
+ error_count += errors
92
90
 
93
91
  return warning_count, error_count
94
92
 
@@ -120,17 +118,15 @@ def print_out_log_by_log_level(log_list, log_level):
120
118
  if log['level'] >= log_level and log['message'] not in ['', '\n', '\r\n']:
121
119
  print(log['message'])
122
120
 
123
- def output_log_by_log_level():
124
- log_level = get_log_level()
125
- main_log_file_path = os.path.join("logs", "log.txt")
126
- print_out_log_by_log_level(parse_log(main_log_file_path), log_level)
127
-
128
- package_logs_folder = os.path.join("logs", "package_logs")
129
- # Check if the directory exists before trying to list its contents
130
- if os.path.exists(package_logs_folder) and os.path.isdir(package_logs_folder):
131
- for log_file in os.listdir(package_logs_folder):
132
- log_file_path = os.path.join(package_logs_folder, log_file)
133
- print_out_log_by_log_level(parse_log(log_file_path), log_level)
121
+ def output_log_by_log_level():
122
+ log_level = get_log_level()
123
+ main_log_file_path = os.path.join("logs", "log.txt")
124
+ print_out_log_by_log_level(parse_log(main_log_file_path), log_level)
125
+
126
+ package_logs_folder = os.path.join("logs", "package_logs")
127
+ for log_file in os.listdir(package_logs_folder):
128
+ log_file_path = os.path.join(package_logs_folder, log_file)
129
+ print_out_log_by_log_level(parse_log(log_file_path), log_level)
134
130
 
135
131
  async def run_async_subprocess(exe_path, cmd, logger, cwd=None):
136
132
  if cwd is None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: py2docfx
3
- Version: 0.1.19.dev2192444
3
+ Version: 0.1.19.dev2192635
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,13 +1,13 @@
1
1
  py2docfx/__init__.py,sha256=kPRhPGPC1JknDotkksG428c1iIgfFr_4_7Jm-llrowY,72
2
- py2docfx/__main__.py,sha256=NDKRx5RhLJP6Z6zFEdGZJje69jxPaGeHLU_2e5GYUO4,5958
2
+ py2docfx/__main__.py,sha256=DWLEx3XbEmDbGrwe1QWm5dBW_a8FJdzp_7uQeXaEgN0,5928
3
3
  py2docfx/convert_prepare/__init__.py,sha256=XxtxrP0kmW3ZBHIAoxsPDEHzcgeC0WSnole8Lk6CjKs,11
4
4
  py2docfx/convert_prepare/arg_parser.py,sha256=Wa1iK8a0Gb3QqaS4X7nUPGvh-7mWhuBS9IVbmnjC770,7606
5
5
  py2docfx/convert_prepare/constants.py,sha256=RC5DqNkqWvx4hb91FrajZ1R9dBFLxcPyoEJ43jdm36E,102
6
6
  py2docfx/convert_prepare/environment.py,sha256=CF8g2hnpwFXsTfvp1O8lwYpR848iCK8bDM2UAWqibEQ,7286
7
7
  py2docfx/convert_prepare/generate_conf.py,sha256=wqs6iyElzJarH-20_qEL9zvZvt5xfBMsGXSXPSZy6wg,2295
8
8
  py2docfx/convert_prepare/generate_document.py,sha256=iTOCMBwkfvZEj5dlEGUq4qynUodaYxJuIrG9R5eGk38,2949
9
- py2docfx/convert_prepare/get_source.py,sha256=I_-QXXFFraMruDf13xlkwGAs5hDuv-wAjW3w-ylOw2Q,6930
10
- py2docfx/convert_prepare/git.py,sha256=Cq76ooxejKlVJiJWWbBhbLZ_JvxqN2ka12L8jkl80b4,6492
9
+ py2docfx/convert_prepare/get_source.py,sha256=p7ktERW-OtA02O1RnikKb8EYmuUVKrqAlznOA-IvCDw,5441
10
+ py2docfx/convert_prepare/git.py,sha256=Qb6uexUo3KKwp2Hq9Q27gMU4Z2P8ZBk7JcSmxBfFCBY,6491
11
11
  py2docfx/convert_prepare/install_package.py,sha256=aJxQBwLRPTIKpdtLVl-SaXPaF_OX_H1ZtWmcKD8Zzuk,274
12
12
  py2docfx/convert_prepare/pack.py,sha256=Jjj9ps8ESoKUFmSk6VgNmxOwMhuwirnQ-rhqigH-4VY,1578
13
13
  py2docfx/convert_prepare/package_info.py,sha256=-zrMNeAkHxxzLRjBl1kRehUJy_ugc16yns-xdcAHQIQ,7711
@@ -65,7 +65,7 @@ py2docfx/docfx_yaml/convert_enum.py,sha256=HX6qdjDbdbBblx-TH41JXBLIJY3wzL3if-qnL
65
65
  py2docfx/docfx_yaml/convert_module.py,sha256=GptO1MRwaQ2Qbu724F0kCDDQQTZe7mWOtrOp3Rzgl-I,2259
66
66
  py2docfx/docfx_yaml/convert_package.py,sha256=Ep7PmvoLInDvY6OU5dveR6iVwyzGRkW3q6lX7yGJ0JE,2109
67
67
  py2docfx/docfx_yaml/directives.py,sha256=zVVuNM_6AU9G6sbqL1UAyHHgPe7bkBWbthXI-PO5ez0,879
68
- py2docfx/docfx_yaml/logger.py,sha256=V09O17R0YFvLFKKc5-aSXWO4iFufQzpgaxMa6EzNqHM,6817
68
+ py2docfx/docfx_yaml/logger.py,sha256=gz416vqSqmsD91qLOCLAzomczlCfWqGXFJFRzLlVbJE,6503
69
69
  py2docfx/docfx_yaml/miss_reference.py,sha256=NHoQtas0kvFsJXaR4fsk7kHjwV4aJobrr_Q30HaUc_I,2450
70
70
  py2docfx/docfx_yaml/nodes.py,sha256=tBDi35jLJArlobl07DKOkmH2qz7dudXLp_kTUfR_r2w,412
71
71
  py2docfx/docfx_yaml/parameter_utils.py,sha256=04wQCtbS-G2hWM5UGkL22s10LZLUbqbh3RM9rWGOToI,10897
@@ -3913,7 +3913,7 @@ py2docfx/venv/venv1/Lib/site-packages/wheel/_commands/convert.py,sha256=0wSJMU0m
3913
3913
  py2docfx/venv/venv1/Lib/site-packages/wheel/_commands/pack.py,sha256=o3iwjfRHl7N9ul-M2kHbewLJZnqBLAWf0tzUCwoiTMw,3078
3914
3914
  py2docfx/venv/venv1/Lib/site-packages/wheel/_commands/tags.py,sha256=Rv2ySVb8-qX3osKp3uJgxcIMXkjt43XUD0-zvC6KvnY,4775
3915
3915
  py2docfx/venv/venv1/Lib/site-packages/wheel/_commands/unpack.py,sha256=Y_J7ynxPSoFFTT7H0fMgbBlVErwyDGcObgme5MBuz58,1021
3916
- py2docfx-0.1.19.dev2192444.dist-info/METADATA,sha256=MCJHbQ0eJXL1aKxUwM6tcI_20MWWar1J5QUqgG5_Hzo,548
3917
- py2docfx-0.1.19.dev2192444.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
3918
- py2docfx-0.1.19.dev2192444.dist-info/top_level.txt,sha256=5dH2uP81dczt_qQJ38wiZ-gzoVWasfiJALWRSjdbnYU,9
3919
- py2docfx-0.1.19.dev2192444.dist-info/RECORD,,
3916
+ py2docfx-0.1.19.dev2192635.dist-info/METADATA,sha256=hez1GaWFLjHZZRtBrbfBvYu5vH5liEZK7Q0nHR1pSS4,548
3917
+ py2docfx-0.1.19.dev2192635.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
3918
+ py2docfx-0.1.19.dev2192635.dist-info/top_level.txt,sha256=5dH2uP81dczt_qQJ38wiZ-gzoVWasfiJALWRSjdbnYU,9
3919
+ py2docfx-0.1.19.dev2192635.dist-info/RECORD,,