T2 ruff rule

This commit is contained in:
thomas girod
2024-08-06 11:42:10 +02:00
parent 28d6d8ba96
commit 62bb15317c
11 changed files with 33 additions and 35 deletions

View File

@ -48,20 +48,24 @@ class Command(BaseCommand):
def handle(self, *args, force: bool, **options):
if not os.environ.get("VIRTUAL_ENV", None):
print("No virtual environment detected, this command can't be used")
self.stdout.write(
"No virtual environment detected, this command can't be used"
)
return
desired = self._desired_version()
if desired == self._current_version():
if not force:
print(
self.stdout.write(
f"Version {desired} is already installed, use --force to re-install"
)
return
print(f"Version {desired} is already installed, re-installing")
print(f"Installing xapian version {desired} at {os.environ['VIRTUAL_ENV']}")
self.stdout.write(f"Version {desired} is already installed, re-installing")
self.stdout.write(
f"Installing xapian version {desired} at {os.environ['VIRTUAL_ENV']}"
)
subprocess.run(
[str(Path(__file__).parent / "install_xapian.sh"), desired],
env=dict(os.environ),
).check_returncode()
print("Installation success")
self.stdout.write("Installation success")

View File

@ -35,4 +35,4 @@ class Command(BaseCommand):
root_path = settings.BASE_DIR
with open(root_path / "core/fixtures/SYNTAX.md", "r") as md:
result = markdown(md.read())
print(result, end="")
self.stdout.write(result)