Skip to content

Commit

Permalink
Merge branch 'main' into tryexec
Browse files Browse the repository at this point in the history
  • Loading branch information
mirkobrombin authored Mar 25, 2024
2 parents 50dd4d4 + 0a62687 commit 1899f6d
Show file tree
Hide file tree
Showing 170 changed files with 4,342 additions and 3,771 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
with:
fetch-depth: 0
- name: Set up Python 3.10
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install Ubuntu dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pylint-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
with:
fetch-depth: 0
- name: Set up Python 3.10
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install Ubuntu dependencies
Expand All @@ -31,7 +31,7 @@ jobs:
python3 utils/pylint-parser.py > output/pylint-result
cat output/pylint-result
echo ${{ github.event.number }} > output/pr-number
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: pylint-result
path: output/
2 changes: 1 addition & 1 deletion .github/workflows/pylint-commenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
github.event.workflow_run.conclusion == 'success'
steps:
- name: 'Download artifact'
uses: actions/github-script@v6.4.1
uses: actions/github-script@v7.0.1
with:
script: |
var artifacts = await github.rest.actions.listWorkflowRunArtifacts ({
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Ubuntu dependencies
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/update-manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:

env:
PR_BRANCH: pr/ci-manifest/${{ github.ref_name }}
FEDC_ARGS: --update --require-important-update --commit-only --never-fork "bottles-repository/com.usebottles.bottles.yml"

jobs:
update-manifest:
Expand All @@ -20,7 +21,7 @@ jobs:
path: "bottles-repository"
ref: ${{ github.ref_name }}

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: 'pip'
Expand All @@ -35,14 +36,20 @@ jobs:
git config user.name "github-actions[bot]"
pur -r requirements.txt
pur -r requirements.dev.txt
req2flatpak --requirements-file requirements.txt --yaml --target-platforms 310-x86_64 -o com.usebottles.bottles.pypi-deps.yaml
req2flatpak --requirements-file requirements.txt --yaml --target-platforms 311-x86_64 -o com.usebottles.bottles.pypi-deps.yaml
git diff ${{ github.ref_name }} --exit-code requirements.txt requirements.dev.txt com.usebottles.bottles.pypi-deps.yaml
updated=$?
if [ $updated -ne 0 ]; then
git add requirements.txt requirements.dev.txt com.usebottles.bottles.pypi-deps.yaml
git commit -m "Update PyPI dependencies"
fi
- name: Update arguments
if: github.event_name == 'workflow_dispatch'
run: |
remove_important_update_only=$(sed 's/--require-important-update//g' <<< '${{ env.FEDC_ARGS }}')
echo "FEDC_ARGS=$remove_important_update_only" >> $GITHUB_ENV
- uses: docker://ghcr.io/flathub/flatpak-external-data-checker:latest
env:
GIT_AUTHOR_NAME: github-actions[bot]
Expand All @@ -52,7 +59,7 @@ jobs:
EMAIL: github-actions[bot]@users.noreply.github.com
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: --update --require-important-update --commit-only --never-fork "bottles-repository/com.usebottles.bottles.yml"
args: ${{ env.FEDC_ARGS }}

- name: Create PR if necessary
working-directory: "bottles-repository"
Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
<img src="https://img.shields.io/badge/License-GPL--3.0-blue.svg">
</a>
<br>
<a href="https://github.com/bottlesdevs/Bottles/actions">
<img src="https://github.com/bottlesdevs/Bottles/workflows/Build%20release%20packages/badge.svg">
</a>
<a href="https://stopthemingmy.app" title="Please do not theme this app">
<img src="https://stopthemingmy.app/badge.svg">
</a>
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
51.9
51.11
29 changes: 18 additions & 11 deletions bottles/backend/cabextract.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class CabExtract:
extracts the file in a new directory with the input name under the Bottles'
temp directory.
"""

requirements: bool = False
path: str
name: str
Expand All @@ -42,7 +43,13 @@ class CabExtract:
def __init__(self):
self.cabextract_bin = shutil.which("cabextract")

def run(self, path: str, name: str = "", files: Optional[list] = None, destination: str = ""):
def run(
self,
path: str,
name: str = "",
files: Optional[list] = None,
destination: str = "",
):
if files is None:
files = []

Expand Down Expand Up @@ -70,10 +77,10 @@ def __extract(self) -> bool:
try:
if len(self.files) > 0:
for file in self.files:
'''
"""
if file already exists as a symlink, remove it
preventing broken symlinks
'''
"""
if os.path.exists(os.path.join(self.destination, file)):
if os.path.islink(os.path.join(self.destination, file)):
os.unlink(os.path.join(self.destination, file))
Expand All @@ -82,27 +89,27 @@ def __extract(self) -> bool:
self.cabextract_bin,
f"-F '*{file}*'",
f"-d {self.destination}",
f"-q {self.path}"
f"-q {self.path}",
]
command = " ".join(command)
subprocess.Popen(
command,
shell=True
).communicate()
subprocess.Popen(command, shell=True).communicate()

if len(file.split("/")) > 1:
_file = file.split("/")[-1]
_dir = file.replace(_file, "")
if not os.path.exists(f"{self.destination}/{_file}"):
shutil.move(f"{self.destination}/{_dir}/{_file}", f"{self.destination}/{_file}")
shutil.move(
f"{self.destination}/{_dir}/{_file}",
f"{self.destination}/{_file}",
)
else:
command_list = [
self.cabextract_bin,
f"-d {self.destination}",
f"-q {self.path}"
f"-q {self.path}",
]
command = " ".join(command_list)
subprocess.Popen(command, shell=True).communicate()
subprocess.Popen(command, shell=True).communicate()

logging.info(f"Cabinet {self.name} extracted successfully")
return True
Expand Down
18 changes: 5 additions & 13 deletions bottles/backend/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@ class Diff:
This class is no more used by the application, it's just a
reference for future implementations.
"""
__ignored = [
"dosdevices",
"users",
"bottle.yml",
"storage"
]

__ignored = ["dosdevices", "users", "bottle.yml", "storage"]

@staticmethod
def hashify(path: str) -> dict:
Expand All @@ -26,10 +22,10 @@ def hashify(path: str) -> dict:
_files = {}

if path[-1] != os.sep:
'''
"""
Be sure to add a trailing slash at the end of the path to
prevent the correct path name in the result.
'''
"""
path += os.sep

for root, dirs, files in os.walk(path):
Expand Down Expand Up @@ -71,8 +67,4 @@ def compare(parent: dict, child: dict) -> dict:
elif parent[f] != child[f]:
changed.append(f)

return {
"added": added,
"removed": removed,
"changed": changed
}
return {"added": added, "removed": removed, "changed": changed}
52 changes: 31 additions & 21 deletions bottles/backend/dlls/dll.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ def check(self) -> bool:
found = deepcopy(self.dlls)

if None in self.dlls:
logging.error(f"DLL(s) \"{self.dlls[None]}\" path haven't been found, ignoring...")
logging.error(
f'DLL(s) "{self.dlls[None]}" path haven\'t been found, ignoring...'
)
return

for path in self.dlls:
Expand Down Expand Up @@ -82,24 +84,25 @@ def install(self, config: BottleConfig, overrides_only: bool = False, exclude=No
exclude = []

if None in self.checked_dlls:
logging.error(f"DLL(s) \"{self.checked_dlls[None]}\" path haven't been found, ignoring...")
logging.error(
f'DLL(s) "{self.checked_dlls[None]}" path haven\'t been found, ignoring...'
)
return

for path in self.checked_dlls:
for dll in self.checked_dlls[path]:
if dll not in exclude:
dll_name = dll.split('/')[-1].split('.')[0]
dll_name = dll.split("/")[-1].split(".")[0]
if overrides_only:
dll_in.append(dll_name)
else:
if self.__install_dll(config, path, dll, False):
dll_in.append(dll_name)

for dll in dll_in:
bundle["HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides"].append({
"value": dll,
"data": "native,builtin"
})
bundle["HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides"].append(
{"value": dll, "data": "native,builtin"}
)

reg.import_bundle(bundle)

Expand All @@ -112,21 +115,22 @@ def uninstall(self, config: BottleConfig, exclude=None):
exclude = []

if None in self.dlls:
logging.error(f"DLL(s) \"{self.dlls[None]}\" path haven't been found, ignoring...")
logging.error(
f'DLL(s) "{self.dlls[None]}" path haven\'t been found, ignoring...'
)
return

for path in self.dlls:
for dll in self.dlls[path]:
if dll not in exclude:
dll_name = dll.split('/')[-1].split('.')[0]
dll_name = dll.split("/")[-1].split(".")[0]
if self.__uninstall_dll(config, path, dll):
dll_in.append(dll_name)

for dll in dll_in:
bundle["HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides"].append({
"value": dll,
"data": "-"
})
bundle["HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides"].append(
{"value": dll, "data": "-"}
)

reg.import_bundle(bundle)

Expand All @@ -136,14 +140,18 @@ def __get_sys_path(config: BottleConfig, path: str):
if path in ["x32", "x86"]:
return "system32"
if config.Arch == Arch.WIN64:
if path in ["x64"] or any(arch in path for arch in ("x86_64", "lib64", "lib/")):
if path in ["x64"] or any(
arch in path for arch in ("x86_64", "lib64", "lib/")
):
return "system32"
if path in ["x32", "x86"]:
return "syswow64"
return None

def __install_dll(self, config: BottleConfig, path: str, dll: str, remove: bool = False):
dll_name = dll.split('/')[-1]
def __install_dll(
self, config: BottleConfig, path: str, dll: str, remove: bool = False
):
dll_name = dll.split("/")[-1]
bottle = ManagerUtils.get_bottle_path(config)
bottle = os.path.join(bottle, "drive_c", "windows")
source = os.path.join(self.base_path, path, dll)
Expand All @@ -163,27 +171,29 @@ def __install_dll(self, config: BottleConfig, path: str, dll: str, remove: bool
try:
shutil.copyfile(source, target)
except FileNotFoundError:
logging.warning(f"{source} not found") # TODO: should not be ok but just ignore it for now
logging.warning(
f"{source} not found"
) # TODO: should not be ok but just ignore it for now
return False
'''
"""
reg.add(
key="HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides",
value=dll_name.split('.')[0],
data="native,builtin"
)
'''
"""
return True

if os.path.exists(f"{target}.bck"):
shutil.move(f"{target}.bck", target)
elif os.path.exists(target):
os.remove(target)
'''
"""
reg.remove(
key="HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides",
value=dll_name.split('.')[0]
)
'''
"""
return True

def __uninstall_dll(self, config, path: str, dll: str):
Expand Down
14 changes: 2 additions & 12 deletions bottles/backend/dlls/dxvk.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,8 @@

class DXVKComponent(DLLComponent):
dlls = {
"x32": [
"d3d9.dll",
"d3d10core.dll",
"d3d11.dll",
"dxgi.dll"
],
"x64": [
"d3d9.dll",
"d3d10core.dll",
"d3d11.dll",
"dxgi.dll"
]
"x32": ["d3d9.dll", "d3d10core.dll", "d3d11.dll", "dxgi.dll"],
"x64": ["d3d9.dll", "d3d10core.dll", "d3d11.dll", "dxgi.dll"],
}

@staticmethod
Expand Down
Loading

0 comments on commit 1899f6d

Please sign in to comment.