Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9fdce79

Browse files
committed
. f Add bright green console output with clean conversion messages
1 parent 7bf10bd commit 9fdce79

23 files changed

+242
-766
lines changed

.github/scripts/build_nuitka.py

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,7 @@ def get_platform_name():
1919
machine = platform.machine().lower()
2020

2121
# Normalize machine architecture names for consistency
22-
machine_map = {
23-
"amd64": "x86_64",
24-
"x86_64": "x86_64",
25-
"arm64": "aarch64",
26-
"aarch64": "aarch64",
27-
}
22+
machine_map = {"amd64": "x86_64", "x86_64": "x86_64", "arm64": "aarch64", "aarch64": "aarch64"}
2823
machine = machine_map.get(machine, machine)
2924

3025
# Platform-specific naming
@@ -343,18 +338,7 @@ def create_archive(executable_name):
343338
archive_name = f"eir-{version}-{platform_name}.tar.gz"
344339

345340
subprocess.run( # noqa: S603
346-
[
347-
"tar",
348-
"-czf",
349-
f"dist/{archive_name}",
350-
"-C",
351-
"dist",
352-
executable_name,
353-
"-C",
354-
"..",
355-
"README.md",
356-
"LICENSE",
357-
]
341+
["tar", "-czf", f"dist/{archive_name}", "-C", "dist", executable_name, "-C", "..", "README.md", "LICENSE"]
358342
+ (["-C", "..", "CHANGELOG.md"] if Path("CHANGELOG.md").exists() else []),
359343
check=True,
360344
)
@@ -376,11 +360,7 @@ def test_executable(executable_name):
376360
# Test --version
377361
try:
378362
result = subprocess.run( # noqa: S603
379-
[str(exe_path.resolve()), "--version"],
380-
capture_output=True,
381-
text=True,
382-
timeout=30,
383-
check=False,
363+
[str(exe_path.resolve()), "--version"], capture_output=True, text=True, timeout=30, check=False
384364
)
385365

386366
if result.returncode == 0:
@@ -398,11 +378,7 @@ def test_executable(executable_name):
398378
# Test --help
399379
try:
400380
result = subprocess.run( # noqa: S603
401-
[str(exe_path.resolve()), "--help"],
402-
capture_output=True,
403-
text=True,
404-
timeout=30,
405-
check=False,
381+
[str(exe_path.resolve()), "--help"], capture_output=True, text=True, timeout=30, check=False
406382
)
407383

408384
if result.returncode == 0:

.github/scripts/download_dnglab.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@ def get_platform_info(self):
9292
self.arch = "arm64"
9393

9494
if self.arch not in self.arch_mapping[platform_key]:
95-
raise ValueError(
96-
f"Unsupported architecture {self.arch} for platform {self.platform_name}"
97-
)
95+
raise ValueError(f"Unsupported architecture {self.arch} for platform {self.platform_name}")
9896

9997
mapped_arch = self.arch_mapping[platform_key][self.arch]
10098

.github/scripts/package_build.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,7 @@ def create_debian_package(version):
104104
control_content = Path("packaging/debian/control").read_text(encoding="utf-8")
105105
# Replace any existing version with the new one
106106
control_content = re.sub(r"Version:\s+[^\s]+", f"Version: {version}", control_content)
107-
control_content = control_content.replace(
108-
"Architecture: amd64", f"Architecture: {deb_arch}"
109-
)
107+
control_content = control_content.replace("Architecture: amd64", f"Architecture: {deb_arch}")
110108

111109
control_file = debian_dir / "control"
112110
control_file.write_text(control_content, encoding="utf-8")
@@ -134,10 +132,7 @@ def create_debian_package(version):
134132
Path(deb_filename).parent.mkdir(parents=True, exist_ok=True)
135133

136134
result = subprocess.run( # noqa: S603,S607
137-
["dpkg-deb", "--build", str(pkg_dir), deb_filename],
138-
check=True,
139-
capture_output=True,
140-
text=True,
135+
["dpkg-deb", "--build", str(pkg_dir), deb_filename], check=True, capture_output=True, text=True
141136
)
142137
print(f"stdout: {result.stdout}")
143138

@@ -195,10 +190,7 @@ def create_apt_repository(_version, deb_packages):
195190

196191
# Create Packages file
197192
result = subprocess.run( # noqa: S603,S607
198-
["dpkg-scanpackages", f"pool/{component}", "/dev/null"],
199-
capture_output=True,
200-
text=True,
201-
check=True,
193+
["dpkg-scanpackages", f"pool/{component}", "/dev/null"], capture_output=True, text=True, check=True
202194
)
203195

204196
# Write Packages file for each architecture
@@ -233,9 +225,7 @@ def create_apt_repository(_version, deb_packages):
233225
# Add checksums for all architectures
234226
all_packages_files = []
235227
for arch in architectures:
236-
all_packages_files.extend(
237-
[f"{component}/binary-{arch}/Packages", f"{component}/binary-{arch}/Packages.gz"]
238-
)
228+
all_packages_files.extend([f"{component}/binary-{arch}/Packages", f"{component}/binary-{arch}/Packages.gz"])
239229

240230
# MD5Sum (keeping for compatibility even though it's insecure)
241231
release_content += "MD5Sum:\n"
@@ -300,9 +290,7 @@ def update_chocolatey_package(version, checksum):
300290
content = re.sub(r"\$version\s*=\s*'[^']*'", f"$version = '{version}'", content)
301291
content = content.replace("REPLACE_WITH_ACTUAL_CHECKSUM", checksum)
302292
# Fix the URL to match the actual binary filename format
303-
content = re.sub(
304-
r"eir-\$version-windows-amd64\.exe", "eir-$version-windows-x86_64.exe", content
305-
)
293+
content = re.sub(r"eir-\$version-windows-amd64\.exe", "eir-$version-windows-x86_64.exe", content)
306294
install_path.write_text(content, encoding="utf-8")
307295

308296
print(f"Updated Chocolatey package files for version {version}")

.github/scripts/version_bump.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ def main():
7070
sys.exit(1)
7171

7272
# Update pyproject.toml
73-
new_content = re.sub(
74-
r'^version = "[^"]+"', f'version = "{new_version}"', content, flags=re.MULTILINE
75-
)
73+
new_content = re.sub(r'^version = "[^"]+"', f'version = "{new_version}"', content, flags=re.MULTILINE)
7674

7775
pyproject_path.write_text(new_content, encoding="utf-8")
7876

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"exiftool",
1818
"ilammy",
1919
"Leica",
20+
"LIGHTGREEN",
2021
"MSVC",
2122
"noupx",
2223
"Nuitka",

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ skip_covered = true
8989

9090

9191
[tool.ruff]
92-
line-length = 98
92+
line-length = 130
9393
indent-width = 4
9494
src = ["src", "tests"]
9595

src/eir/clo.py

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,8 @@ def __init__(self, args: list = None, options: Namespace = None): # type: ignor
3535

3636
def handle_options(self) -> None:
3737
"""Handles user specified options and arguments."""
38-
parser = ArgumentParser(
39-
prog="eir", description="eir - rename and translate images from raw to dng format"
40-
)
41-
parser.add_argument(
42-
"-a", "--about", action="store_true", help="Show detailed project metadata"
43-
)
38+
parser = ArgumentParser(prog="eir", description="eir - rename and translate images from raw to dng format")
39+
parser.add_argument("-a", "--about", action="store_true", help="Show detailed project metadata")
4440
parser.add_argument(
4541
"-d",
4642
"--directory",
@@ -50,33 +46,19 @@ def handle_options(self) -> None:
5046
help="directory, where images will be converted and renamed",
5147
)
5248
parser.add_argument(
53-
"-l",
54-
"--log_into_file",
55-
action="store_true",
56-
dest="log_into_file",
57-
default=False,
58-
help="log into logs/eir.log",
49+
"-l", "--log_into_file", action="store_true", dest="log_into_file", default=False, help="log into logs/eir.log"
5950
)
6051
parser.add_argument("-q", "--quiet", action="store_true", help="Suppresses all logs")
61-
parser.add_argument(
62-
"--verbose",
63-
action="store_true",
64-
help="Enable verbose debug logging (shows DEBUG level messages)",
65-
)
66-
parser.add_argument(
67-
"-v", "--version", action="store_true", help="Show version info and exit"
68-
)
52+
parser.add_argument("--verbose", action="store_true", help="Enable verbose debug logging (shows DEBUG level messages)")
53+
parser.add_argument("-v", "--version", action="store_true", help="Show version info and exit")
6954
parser.add_argument(
7055
"--dng-compression",
7156
choices=["lossless", "uncompressed"],
7257
default="lossless",
7358
help="DNG compression method: lossless (default) or uncompressed",
7459
)
7560
parser.add_argument(
76-
"--dng-preview",
77-
action="store_true",
78-
default=False,
79-
help="Embed JPEG preview in DNG files (increases file size)",
61+
"--dng-preview", action="store_true", default=False, help="Embed JPEG preview in DNG files (increases file size)"
8062
)
8163
self.options = parser.parse_args()
8264

@@ -98,9 +80,7 @@ def handle_options(self) -> None:
9880
sys.exit(0)
9981

10082
LoggerManager().configure(
101-
log_into_file=self.options.log_into_file,
102-
quiet=self.options.quiet,
103-
verbose=self.options.verbose,
83+
log_into_file=self.options.log_into_file, quiet=self.options.quiet, verbose=self.options.verbose
10484
)
10585
self.logger = LoggerManager().get_logger()
10686
self.logger.info(f"{self.options=}")

src/eir/constants.py

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ def _find_project_root(self, start: Path | None = None) -> Path:
5252
current_file_path = Path(__file__).absolute()
5353
current_path_str = str(current_file_path).lower()
5454
is_onefile = (
55-
"onefile" in current_path_str
56-
or "onefil" in current_path_str # Windows short names like ONEFIL~1
55+
"onefile" in current_path_str or "onefil" in current_path_str # Windows short names like ONEFIL~1
5756
)
5857
if is_onefile:
5958
return Path.cwd()
@@ -96,9 +95,7 @@ def _load_from_pyproject(self):
9695
object.__setattr__(self, "_license", project.get("license", self._license))
9796
object.__setattr__(self, "_keywords", project.get("keywords", self._keywords))
9897
object.__setattr__(self, "_authors", project.get("authors", self._authors))
99-
object.__setattr__(
100-
self, "_maintainers", project.get("maintainers", self._maintainers)
101-
)
98+
object.__setattr__(self, "_maintainers", project.get("maintainers", self._maintainers))
10299
except Exception as e:
103100
print(f"Warning: failed to load pyproject.toml metadata: {e}")
104101

@@ -121,29 +118,10 @@ def _load_from_build_constants(self):
121118
object.__setattr__(self, "_name", "eir")
122119
object.__setattr__(self, "_license", {"text": "MIT"})
123120
object.__setattr__(
124-
self,
125-
"_keywords",
126-
[
127-
"exif",
128-
"images",
129-
"photos",
130-
"rename",
131-
"convert",
132-
"raw",
133-
"dng",
134-
"photography",
135-
],
136-
)
137-
object.__setattr__(
138-
self,
139-
"_authors",
140-
[{"name": "ABK", "email": "[email protected]"}],
141-
)
142-
object.__setattr__(
143-
self,
144-
"_maintainers",
145-
[{"name": "ABK", "email": "[email protected]"}],
121+
self, "_keywords", ["exif", "images", "photos", "rename", "convert", "raw", "dng", "photography"]
146122
)
123+
object.__setattr__(self, "_authors", [{"name": "ABK", "email": "[email protected]"}])
124+
object.__setattr__(self, "_maintainers", [{"name": "ABK", "email": "[email protected]"}])
147125
except Exception as e:
148126
print(f"Warning: failed to load build constants: {e}")
149127

0 commit comments

Comments
 (0)