version not needed now

This commit is contained in:
lllyasviel
2024-01-27 10:40:32 -08:00
parent ccea2f3305
commit 0659e8da2a
3 changed files with 2 additions and 65 deletions

View File

@@ -1,53 +0,0 @@
import re
import subprocess
def get_current_version(filename):
version_pattern = r"version_flag\s*=\s*'v(\d+\.\d+\.\d+)'"
with open(filename, "r") as file:
content = file.read()
match = re.search(version_pattern, content)
if match:
return match.group(1)
else:
raise ValueError("Version number not found in the file")
def increment_version(version):
major, minor, patch = map(int, version.split("."))
patch += 1 # Increment the patch number
return f"{major}.{minor}.{patch}"
def update_version_file(filename, new_version):
with open(filename, "r") as file:
content = file.read()
new_content = re.sub(
r"version_flag = 'v\d+\.\d+\.\d+'", f"version_flag = 'v{new_version}'", content
)
with open(filename, "w") as file:
file.write(new_content)
def git_commit_and_tag(filename, new_version):
commit_message = f":memo: Update to version v{new_version}"
tag_name = f"v{new_version}"
# Commit the changes
subprocess.run(["git", "add", filename], check=True)
subprocess.run(["git", "commit", "-m", commit_message], check=True)
# Create a new tag
subprocess.run(["git", "tag", tag_name], check=True)
if __name__ == "__main__":
filename = "scripts/controlnet_version.py"
current_version = get_current_version(filename)
new_version = increment_version(current_version)
update_version_file(filename, new_version)
git_commit_and_tag(filename, new_version)

View File

@@ -12,7 +12,7 @@ import gradio as gr
import time
from einops import rearrange
from scripts import global_state, hook, external_code, batch_hijack, controlnet_version, utils
from scripts import global_state, hook, external_code, batch_hijack, utils
from scripts.controlnet_lora import bind_control_lora, unbind_control_lora
from scripts.processor import *
from scripts.controlnet_lllite import clear_all_lllite
@@ -295,7 +295,7 @@ class Script(scripts.Script, metaclass=(
max_models = shared.opts.data.get("control_net_unit_count", 3)
elem_id_tabname = ("img2img" if is_img2img else "txt2img") + "_controlnet"
with gr.Group(elem_id=elem_id_tabname):
with gr.Accordion(f"ControlNet {controlnet_version.version_flag}", open = False, elem_id="controlnet"):
with gr.Accordion(f"ControlNet Integrated", open = False, elem_id="controlnet"):
photopea = Photopea() if not shared.opts.data.get("controlnet_disable_photopea_edit", False) else None
if max_models > 1:
with gr.Tabs(elem_id=f"{elem_id_tabname}_tabs"):

View File

@@ -1,10 +0,0 @@
version_flag = 'v1.1.438'
from scripts.logging import logger
logger.info(f"ControlNet {version_flag}")
# A smart trick to know if user has updated as well as if user has restarted terminal.
# Note that in "controlnet.py" we do NOT use "importlib.reload" to reload this "controlnet_version.py"
# This means if user did not completely restart terminal, the "version_flag" will be the previous version.
# Then, if we get a screenshot from user, we will know that if that user has restarted the terminal.
# And we will also know what version the user is using so that bug track becomes easier.