Skip to content

Commit

Permalink
Merge branch 'main' into minor-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
TheEvilSkeleton authored Jul 31, 2023
2 parents b20e79b + 9aa8e25 commit c620e65
Show file tree
Hide file tree
Showing 192 changed files with 34,399 additions and 28,814 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ref: https://git-scm.com/docs/gitattributes
* text=auto eol=lf
8 changes: 4 additions & 4 deletions .github/workflows/build_flatpak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ jobs:
name: "build-packages"
runs-on: ubuntu-latest
container:
image: bilelmoussaoui/flatpak-github-actions:gnome-43
image: bilelmoussaoui/flatpak-github-actions:gnome-44
options: --privileged
steps:
- uses: actions/checkout@v2
- uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v4
- uses: actions/checkout@v3
- uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v6
with:
bundle: bottles.flatpak
manifest-path: com.usebottles.bottles.yml
cache-key: flatpak-builder-${{ github.sha }}
cache-key: flatpak-builder-${{ github.sha }}
42 changes: 42 additions & 0 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
on:
pull_request_target:
types: [opened, synchronize, reopened]

name: Mypy
jobs:
mypy-checker:
name: Checker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Ubuntu dependencies
run: |
sudo apt update
sudo apt install -y libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-3.0
sudo apt install -y libcurl4-openssl-dev libssl-dev
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements.dev.txt
- name: Run mypy analysis
run: |
mypy --version
mypy bottles
sonar:
name: Sonar
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
10 changes: 4 additions & 6 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@v3
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Ubuntu dependencies
Expand All @@ -20,20 +20,18 @@ jobs:
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install wheel
pip install pylint
pip install -r requirements.txt
pip install pycairo
pip install PyGObject
pip install -r requirements.dev.txt
- name: Analysing the code with pylint
id: pylint-result
continue-on-error: true
run: |
pylint --version
mkdir -p output
python3 utils/pylint-parser.py > output/pylint-result
cat output/pylint-result
echo ${{ github.event.number }} > output/pr-number
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: pylint-result
path: output/
28 changes: 28 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
on:
push:
branches: [main]
pull_request:
name: Pytest
jobs:
pytest-testing:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install Ubuntu dependencies
run: |
sudo apt update
sudo apt install -y libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-3.0
sudo apt install -y libcurl4-openssl-dev libssl-dev
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements.dev.txt
- name: Test with pytest
run: |
python -m pytest --version
python -m pytest bottles
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ If all apply, then please consider opening a [new issue](https://github.com/bott
## Want to Submit Code?
You can submit code by [forking](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks) this project, editing the desired code and finally submitting a [pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).

To build Bottles, refer to the [Building](README.md#Building) instructions.

### Having Trouble Understanding the Source Code?
If you want to inquire to understand the code base, you can contact us via [Discord](https://discord.com/invite/wF4JAdYrTR). We'd love to help you out!

Expand Down
103 changes: 38 additions & 65 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<div align="center">
<img src="https://raw.githubusercontent.com/bottlesdevs/Bottles/main/data/icons/hicolor/scalable/apps/com.usebottles.bottles.svg" width="64">
<h1 align="center">Bottles</h1>
<p align="center">Easily run Windows Software using Bottles</p>
<p align="center">Run Windows Software on Linux</p>
</div>

<br/>

<div align="center">
<a href="https://flathub.org/apps/com.usebottles.bottles">
<img alt="Flathub" src="https://img.shields.io/flathub/downloads/com.usebottles.bottles" />
</a>
<a href="https://hosted.weblate.org/engage/bottles">
<img src="https://hosted.weblate.org/widgets/bottles/-/bottles/svg-badge.svg" />
</a>
Expand All @@ -16,89 +19,59 @@
<a href="https://github.com/bottlesdevs/Bottles/blob/main/LICENSE">
<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>
<br>
<a href="https://stopthemingmy.app" title="Please do not theme this app">
<img src="https://stopthemingmy.app/badge.svg">
</a>

<hr />

<a href="https://docs.usebottles.com">Documentation</a> ·
<a href="https://forums.usebottles.com">Forums</a> ·
<a href="https://t.me/usebottles">Telegram group</a> ·
<a href="https://forum.usebottles.com">Forums</a> ·
<a href="https://discord.gg/wF4JAdYrTR">Discord</a> ·
<a href="https://usebottles.com/funding">Funding</a>
</div>

<br/>

![Bottles Dark](docs/screenshot-dark.png#gh-dark-mode-only)![Bottles Light](docs/screenshot-light.png#gh-light-mode-only)

## 📚 Documentation
Before opening a new issue, check if the topic has already been covered
in our [documentation](https://docs.usebottles.com).

Please note that some pages of the documentation are still being written.

## 🗣 Help Bottles speak your language
Read [here](po#readme) how to translate Bottles to your language or how to help
improve existing ones.

## 🦾 Features
- Create bottles based on environments (a set of rules and dependencies)
- Access to a customizable environment for all your experiments
- Automated installers
- Run every executable (.exe/.msi/.bat) in your bottles, using the context menu in your file manager
- Integrated management and storage for executable file arguments
- Support for custom environment variables
- Simplified DLL overrides
- Manage and install multiple wine/proton/dxvk versions and on-the-fly change
- Various optimizations for better gaming performance (esync, fsync, dxvk, cache, shader compiler, offload ... and much more.)
- Tweak different wine prefix settings, without leaving Bottles
- Automated dxvk installation
- System for checking runner updates for the bottle and automatic repair in case of breakage
- Integrated Dependencies installer with compatibility check based on a community-driven [repository](https://github.com/bottlesdevs/dependencies)
- Detection of installed programs
- Integrated Task manager for wine processes
- Easy access to ProtonDB and WineHQ for support
- Configurations update system across Bottles versions
- Backup and Import bottles from older version and from other managers (Lutris, POL, ..)
- Bottles versioning
- ... and much more that you can find by installing Bottles!

### 🚧 Work in progress
- Layers (dependencies and programs on different layers) [#510](https://github.com/bottlesdevs/Bottles/issues/510)

## ↗️ Install
Bottles is officially provided as [Flatpak](https://flathub.org/apps/details/com.usebottles.bottles).

Read [here](https://docs.usebottles.com/getting-started/installation) how to
install Bottles on your distribution.

### Notices for package maintainers
We are happy to see packaged Bottles but we ask you to respect some small rules:
- The package must be `bottles`. In other distributions it is possible to use suffixes (e.g. `bottles-git` on Arch Linux for the git based package) while on others the RDNN format is required (e.g. `com.usebottles.bottles` on elementary OS and Flathub repository). All other nomenclatures are discouraged.
- Do not package external files and do not make changes to the code, no hard script. Obviously with the exception of files essential for packaging.
- Package version should follow the CalVer model (year.month.day) and the release cycle of the project. Bottles has 2 releases per month: one on 14th and one on 28th. When a hotfix is released, this will be appended to the release version (e.g. 2022.2.14-1). Bottles has a codename too which is not mandatory and currently only used by the Flatpak.

## Shortcuts
| Shortcut | Action |
|:--------:|:-----------------------:|
| `Ctrl+Q` | Close Bottles |
| `Ctrl+R` | Reload the Bottles list |
| `F1` | Go to the documentation |
| `Esc` | Go back |

## FAQ
- [Why Bottles?](https://docs.usebottles.com/faq/why-bottles)
- [Where is Winetricks?](https://docs.usebottles.com/faq/where-is-winetricks)
- [Older versions will be deprecated?](https://docs.usebottles.com/faq/updates-and-old-versions#older-versions-will-be-deprecated)
- [Backward compatibility?](https://docs.usebottles.com/faq/updates-and-old-versions#backward-compatibility)
## Installation

<a href='https://flathub.org/apps/com.usebottles.bottles'><img width='240' alt='Download on Flathub' src='https://flathub.org/assets/badges/flathub-badge-en.png'/></a>

## Contributing

Refer to the [Contributing](CONTRIBUTING.md) page.

## Building

⚠️ Be sure to backup all your data before testing experimental builds of Bottles!

There are two methods to build Bottles. The first and longer method is using `org.flatpak.Builder`, and the second but shorter method is building directly.

### org.flatpak.Builder

1. Install [`org.flatpak.Builder`](https://github.com/flathub/org.flatpak.Builder) from Flathub
1. Clone `https://github.com/bottlesdevs/Bottles.git` (or your fork)
1. Run `flatpak run org.flatpak.Builder --install --install-deps-from=flathub --default-branch=master --force-clean build-dir com.usebottles.bottles.yml` in the terminal from the root of the repository (use `--user` if necessary)
1. Run `flatpak run com.usebottles.bottles//master` to launch it

### Meson

Since Bottles is primarily and officially distributed as a Flatpak, we only provide instructions to directly build it inside a Flatpak environment:

1. Download and install the latest build of Bottles: [bottles-x86_64.zip](https://nightly.link/bottlesdevs/Bottles/workflows/build_flatpak/main/bottles-x86_64.zip). Unzip it, and run `flatpak install bottles.flatpak` (use `--user` if necessary)
2. Run `flatpak run -d --filesystem=$PWD --command=bash com.usebottles.bottles//master` from the root of the repository, followed by `./utils/install.sh`. This will build Bottles and install it under the `build/` directory.
3. Run `./build/bin/bottles` to launch Bottles

Due to GNOME Builder limitations, Builder cannot build Bottles for the time being; see [GNOME/gnome-builder#2061](https://gitlab.gnome.org/GNOME/gnome-builder/-/issues/2061) for more context. This is the best workaround we can provide.

## Code of Conduct
This project follows the [GNOME Code of Conduct.](https://wiki.gnome.org/Foundation/CodeOfConduct) You are expected to follow it in all Bottles spaces, such as this repository, project's social media, messenger chats and forums. Bigotry and harassment will not be tolerated.
This project follows the [GNOME Code of Conduct](https://wiki.gnome.org/Foundation/CodeOfConduct). You are expected to follow it in all Bottles spaces, such as this repository, the project's social media, messenger chats and forums. Bigotry and harassment will not be tolerated.

## Sponsors
<a href="https://www.jetbrains.com/?from=bottles"><img height="55" src="https://unifiedban.solutions/static/images/jetbrains-logos/jetbrains.png" /></a>&nbsp;&nbsp;&nbsp;
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
51.5
51.6
8 changes: 4 additions & 4 deletions bottles/backend/cabextract.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import shlex
import shutil
import subprocess
from gettext import gettext as _
from typing import Optional

from bottles.backend.logger import Logger

Expand All @@ -42,7 +42,7 @@ class CabExtract:
def __init__(self):
self.cabextract_bin = shutil.which("cabextract")

def run(self, path: str, name: str = "", files: 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 @@ -96,12 +96,12 @@ def __extract(self) -> bool:
if not os.path.exists(f"{self.destination}/{_file}"):
shutil.move(f"{self.destination}/{_dir}/{_file}", f"{self.destination}/{_file}")
else:
command = [
command_list = [
self.cabextract_bin,
f"-d {self.destination}",
f"-q {self.path}"
]
command = " ".join(command)
command = " ".join(command_list)
subprocess.Popen(command, shell=True).communicate()

logging.info(f"Cabinet {self.name} extracted successfully")
Expand Down
35 changes: 12 additions & 23 deletions bottles/backend/dlls/dll.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,22 @@

import os
import shutil
from glob import glob
from typing import NewType
from abc import abstractmethod
from copy import deepcopy

from bottles.backend.logger import Logger
from bottles.backend.models.config import BottleConfig
from bottles.backend.models.enum import Arch
from bottles.backend.utils.manager import ManagerUtils
from bottles.backend.wine.reg import Reg
from bottles.backend.wine.wineboot import WineBoot

logging = Logger()


class DLLComponent:
base_path: str = None
base_path: str
dlls: dict = {}
checked_dlls: dict = {}
version: str = None

def __init__(self, version: str):
Expand All @@ -43,11 +42,11 @@ def __init__(self, version: str):

@staticmethod
@abstractmethod
def get_base_path(version: str):
def get_base_path(version: str) -> str:
pass

def check(self):
found = self.dlls.copy()
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...")
Expand All @@ -61,22 +60,12 @@ def check(self):
for dll in self.dlls[path]:
_dll = os.path.join(_path, dll)
if not os.path.exists(_dll):
try:
del found[path][dll]
except TypeError:
# WORKAROUND: I'm not able to find what is causing this
# TypeError, I've tested with some different
# setups and I've never been able to reproduce
# it, so I'm just providing a workaround for
# not breaking the app. Thiw workaround removes
# the path from the list of found dlls as it
# seems to empty in some cases.
del found[path]
found[path].remove(dll)

if len(found) == 0:
return False

self.dlls = found
self.checked_dlls = found
return True

def install(self, config: BottleConfig, overrides_only: bool = False, exclude=None):
Expand All @@ -87,12 +76,12 @@ def install(self, config: BottleConfig, overrides_only: bool = False, exclude=No
if exclude is None:
exclude = []

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

for path in self.dlls:
for dll in self.dlls[path]:
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]
if overrides_only:
Expand Down
Loading

0 comments on commit c620e65

Please sign in to comment.