Skip to content

Commit e8dd50d

Browse files
committed
Freeze r2.2
- Remove update/branch switch from GUI - Remove update_deps.py - Freeze requirements - Update installers
1 parent 82e927d commit e8dd50d

File tree

7 files changed

+21
-283
lines changed

7 files changed

+21
-283
lines changed

.install/linux/faceswap_setup_x64.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ clone_faceswap() {
405405
# Clone the faceswap repo
406406
delete_faceswap
407407
info "Downloading Faceswap..."
408-
yellow ; git clone --depth 1 --no-single-branch "$DL_FACESWAP" "$DIR_FACESWAP"
408+
yellow ; git clone --depth 1 --single-branch --branch r2.2 "$DL_FACESWAP" "$DIR_FACESWAP"
409409
}
410410

411411
setup_faceswap() {

.install/windows/install.nsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ InstallDir $PROFILE\faceswap
2121

2222
# Install cli flags
2323
!define flagsConda "/S /RegisterPython=0 /AddToPath=0 /D=$PROFILE\MiniConda3"
24-
!define flagsRepo "--depth 1 --no-single-branch ${wwwRepo}"
24+
!define flagsRepo "--depth 1 --single-branch --branch r2.2 ${wwwRepo}"
2525
!define flagsEnv "-y python=3."
2626

2727
# Folders

lib/gui/menu.py

Lines changed: 0 additions & 228 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
""" The Menu Bars for faceswap GUI """
33

44
import gettext
5-
import locale
65
import logging
76
import os
87
import sys
@@ -11,12 +10,9 @@
1110
from tkinter import ttk
1211
import webbrowser
1312

14-
from subprocess import Popen, PIPE, STDOUT
15-
1613
from lib.multithreading import MultiThread
1714
from lib.serializer import get_serializer, Serializer
1815
from lib.utils import FaceswapError
19-
import update_deps
2016

2117
from .popup_configure import open_popup
2218
from .custom_widgets import Tooltip
@@ -273,130 +269,9 @@ def _output_sysinfo(self):
273269
print(info)
274270
self.root.config(cursor="")
275271

276-
@classmethod
277-
def _check_for_updates(cls, encoding: str, check: bool = False) -> bool:
278-
""" Check whether an update is required
279-
280-
Parameters
281-
----------
282-
encoding: str
283-
The encoding to use for decoding process returns
284-
check: bool
285-
``True`` if we are just checking for updates ``False`` if a check and update is to be
286-
performed. Default: ``False``
287-
288-
Returns
289-
-------
290-
bool
291-
``True`` if an update is required
292-
"""
293-
# Do the check
294-
logger.info("Checking for updates...")
295-
update = False
296-
msg = ""
297-
gitcmd = "git remote update && git status -uno"
298-
with Popen(gitcmd, shell=True, stdout=PIPE, stderr=STDOUT, cwd=_WORKING_DIR) as cmd:
299-
stdout, _ = cmd.communicate()
300-
retcode = cmd.poll()
301-
if retcode != 0:
302-
msg = ("Git is not installed or you are not running a cloned repo. "
303-
"Unable to check for updates")
304-
else:
305-
chk = stdout.decode(encoding, errors="replace").splitlines()
306-
for line in chk:
307-
if line.lower().startswith("your branch is ahead"):
308-
msg = "Your branch is ahead of the remote repo. Not updating"
309-
break
310-
if line.lower().startswith("your branch is up to date"):
311-
msg = "Faceswap is up to date."
312-
break
313-
if line.lower().startswith("your branch is behind"):
314-
msg = "There are updates available"
315-
update = True
316-
break
317-
if "have diverged" in line.lower():
318-
msg = "Your branch has diverged from the remote repo. Not updating"
319-
break
320-
if not update or check:
321-
logger.info(msg)
322-
logger.debug("Checked for update. Update required: %s", update)
323-
return update
324-
325-
def _check(self) -> None:
326-
""" Check for updates and clone repository """
327-
logger.debug("Checking for updates...")
328-
self.root.config(cursor="watch")
329-
encoding = locale.getpreferredencoding()
330-
logger.debug("Encoding: %s", encoding)
331-
self._check_for_updates(encoding, check=True)
332-
self.root.config(cursor="")
333-
334-
@classmethod
335-
def _do_update(cls, encoding: str) -> bool:
336-
""" Update Faceswap
337-
338-
Parameters
339-
----------
340-
encoding: str
341-
The encoding to use for decoding process returns
342-
343-
Returns
344-
-------
345-
bool
346-
``True`` if update was successful
347-
"""
348-
logger.info("A new version is available. Updating...")
349-
gitcmd = "git pull"
350-
with Popen(gitcmd,
351-
shell=True,
352-
stdout=PIPE,
353-
stderr=STDOUT,
354-
bufsize=1,
355-
cwd=_WORKING_DIR) as cmd:
356-
while True:
357-
out = cmd.stdout
358-
output = "" if out is None else out.readline().decode(encoding, errors="replace")
359-
if output == "" and cmd.poll() is not None:
360-
break
361-
if output:
362-
logger.debug("'%s' output: '%s'", gitcmd, output.strip())
363-
print(output.strip())
364-
retcode = cmd.poll()
365-
logger.debug("'%s' returncode: %s", gitcmd, retcode)
366-
if retcode != 0:
367-
logger.info("An error occurred during update. return code: %s", retcode)
368-
retval = False
369-
else:
370-
retval = True
371-
return retval
372-
373-
def _update(self) -> None:
374-
""" Check for updates and clone repository """
375-
logger.debug("Updating Faceswap...")
376-
self.root.config(cursor="watch")
377-
encoding = locale.getpreferredencoding()
378-
logger.debug("Encoding: %s", encoding)
379-
success = False
380-
if self._check_for_updates(encoding):
381-
success = self._do_update(encoding)
382-
update_deps.main(is_gui=True)
383-
if success:
384-
logger.info("Please restart Faceswap to complete the update.")
385-
self.root.config(cursor="")
386-
387272
def _build(self) -> None:
388273
""" Build the help menu """
389274
logger.debug("Building Help menu")
390-
391-
self.add_command(label=_("Check for updates..."),
392-
underline=0,
393-
command=lambda action="_check": self._in_thread(action)) # type:ignore
394-
self.add_command(label=_("Update Faceswap..."),
395-
underline=0,
396-
command=lambda action="_update": self._in_thread(action)) # type:ignore
397-
if self._build_branches_menu():
398-
self.add_cascade(label=_("Switch Branch"), underline=7, menu=self._branches_menu)
399-
self.add_separator()
400275
self._build_recources_menu()
401276
self.add_cascade(label=_("Resources"), underline=0, menu=self.recources_menu)
402277
self.add_separator()
@@ -406,109 +281,6 @@ def _build(self) -> None:
406281
command=lambda action="_output_sysinfo": self._in_thread(action)) # type:ignore
407282
logger.debug("Built help menu")
408283

409-
def _build_branches_menu(self) -> bool:
410-
""" Build branch selection menu.
411-
412-
Queries git for available branches and builds a menu based on output.
413-
414-
Returns
415-
-------
416-
bool
417-
``True`` if menu was successfully built otherwise ``False``
418-
"""
419-
stdout = self._get_branches()
420-
if stdout is None:
421-
return False
422-
423-
branches = self._filter_branches(stdout)
424-
if not branches:
425-
return False
426-
427-
for branch in branches:
428-
self._branches_menu.add_command(
429-
label=branch,
430-
command=lambda b=branch: self._switch_branch(b)) # type:ignore
431-
return True
432-
433-
@classmethod
434-
def _get_branches(cls) -> T.Optional[str]:
435-
""" Get the available github branches
436-
437-
Returns
438-
-------
439-
str or ``None``
440-
The list of branches available. If no branches were found or there was an
441-
error then `None` is returned
442-
"""
443-
gitcmd = "git branch -a"
444-
with Popen(gitcmd, shell=True, stdout=PIPE, stderr=STDOUT, cwd=_WORKING_DIR) as cmd:
445-
stdout, _ = cmd.communicate()
446-
retcode = cmd.poll()
447-
if retcode != 0:
448-
logger.debug("Unable to list git branches. return code: %s, message: %s",
449-
retcode,
450-
stdout.decode(locale.getpreferredencoding(),
451-
errors="replace").strip().replace("\n", " - "))
452-
return None
453-
return stdout.decode(locale.getpreferredencoding(), errors="replace")
454-
455-
@classmethod
456-
def _filter_branches(cls, stdout: str) -> T.List[str]:
457-
""" Filter the branches, remove duplicates and the current branch and return a sorted
458-
list.
459-
460-
Parameters
461-
----------
462-
stdout: str
463-
The output from the git branch query converted to a string
464-
465-
Returns
466-
-------
467-
list[str]
468-
Unique list of available branches sorted in alphabetical order
469-
"""
470-
current = None
471-
branches = set()
472-
for line in stdout.splitlines():
473-
branch = line[line.rfind("/") + 1:] if "/" in line else line.strip()
474-
if branch.startswith("*"):
475-
branch = branch.replace("*", "").strip()
476-
current = branch
477-
continue
478-
branches.add(branch)
479-
logger.debug("Found branches: %s", branches)
480-
if current in branches:
481-
logger.debug("Removing current branch from output: %s", current)
482-
branches.remove(current)
483-
484-
retval = sorted(list(branches), key=str.casefold)
485-
logger.debug("Final branches: %s", retval)
486-
return retval
487-
488-
@classmethod
489-
def _switch_branch(cls, branch: str) -> None:
490-
""" Change the currently checked out branch, and return a notification.
491-
492-
Parameters
493-
----------
494-
str
495-
The branch to switch to
496-
"""
497-
logger.info("Switching branch to '%s'...", branch)
498-
gitcmd = f"git checkout {branch}"
499-
with Popen(gitcmd, shell=True, stdout=PIPE, stderr=STDOUT, cwd=_WORKING_DIR) as cmd:
500-
stdout, _ = cmd.communicate()
501-
retcode = cmd.poll()
502-
if retcode != 0:
503-
logger.error("Unable to switch branch. return code: %s, message: %s",
504-
retcode,
505-
stdout.decode(T.cast(str, locale.getdefaultlocale()),
506-
errors="replace").strip().replace("\n", " - "))
507-
return
508-
logger.info("Succesfully switched to '%s'. You may want to check for updates to make sure "
509-
"that you have the latest code.", branch)
510-
logger.info("Please restart Faceswap to complete the switch.")
511-
512284
def _build_recources_menu(self) -> None:
513285
""" Build resources menu """
514286
# pylint: disable=cell-var-from-loop
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
tqdm>=4.64
2-
psutil>=5.9.0
3-
numexpr>=2.7.3; python_version < '3.9' # >=2.8.0 conflicts in Conda
4-
numexpr>=2.8.3; python_version >= '3.9'
5-
opencv-python>=4.6.0.0
6-
pillow>=9.2.0
1+
tqdm>=4.64,<=4.65.0
2+
psutil==5.9.0
3+
numexpr>=2.7.3,<2.8.0; python_version < '3.9' # >=2.8.0 conflicts in Conda
4+
numexpr>=2.8.3,<2.8.5; python_version >= '3.9'
5+
opencv-python>=4.6.0.0,<=4.7.0.72
6+
pillow>=9.2.0,<=9.4.0
77
scikit-learn==1.0.2; python_version < '3.9' # AMD needs version 1.0.2 and 1.1.0 not available in Python 3.7
8-
scikit-learn>=1.1.0; python_version >= '3.9'
9-
fastcluster>=1.2.6
8+
scikit-learn>=1.1.0,<=1.2.2; python_version >= '3.9'
9+
fastcluster==1.2.6
1010
matplotlib>=3.4.3,<3.6.0; python_version < '3.9' # >=3.5.0 conflicts in Conda
1111
matplotlib>=3.5.1,<3.6.0; python_version >= '3.9'
12-
imageio>=2.19.3
13-
imageio-ffmpeg>=0.4.7
14-
ffmpy>=0.3.0
12+
imageio>=2.19.3,<=2.26.0
13+
imageio-ffmpeg>=0.4.7,<=0.4.8
14+
ffmpy==0.3.0
1515
# Exclude badly numbered Python2 version of nvidia-ml-py
1616
nvidia-ml-py>=11.515,<300
17-
tensorflow-probability<0.17
18-
typing-extensions>=4.0.0
19-
pywin32>=228 ; sys_platform == "win32"
17+
tensorflow-probability>=0.14.0,<0.17
18+
typing-extensions>=4.0.0,<=4.6.3
19+
pywin32>=228,<=305 ; sys_platform == "win32"

requirements/requirements_apple_silicon.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ numpy>=1.22.0,<1.24.0; python_version >= '3.8'
55
tensorflow-macos>=2.8.0,<2.11.0
66
tensorflow-deps>=2.8.0,<2.11.0
77
tensorflow-metal>=0.4.0,<0.7.0
8-
libblas # Conda only
8+
libblas==3.9.0 # Conda only
99
# These next 2 should have been installed, but some users complain of errors
10-
decorator
11-
cloudpickle
10+
decorator>=4.4.0,<=5.1.1
11+
cloudpickle>=2.0.0,<=2.2.1

requirements/requirements_directml.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
numpy>=1.21.0,<1.24.0; python_version < '3.8'
44
numpy>=1.22.0,<1.24.0; python_version >= '3.8'
55
tensorflow-cpu>=2.10.0,<2.11.0
6-
tensorflow-directml-plugin
7-
comtypes
6+
tensorflow-directml-plugin==0.4.0.dev230202
7+
comtypes==1.1.10

update_deps.py

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)