-
-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better linux build support #617
Conversation
This wiki page might also need to be updated to include the .sh files, but i don't think i'm able to update that https://github.com/DevilXD/TwitchDropsMiner/wiki/Setting-up-the-environment,-building-and-running |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reference AppIndicator implementation has been deprecated/abandoned in newer distros. Co-Authored-By: Guilherme Silva <[email protected]>
and done xD |
Hello. I've been more or less absent for the past week or so. I've read the discussion, and I can of course merge this one in. I saw Wiki instructions being mentioned though. Is there something that needs to be changed/added there? The building instructions only really cover Windows support, and I agree that Linux building should also be covered there. |
Mostly only the packages that needs to be installed and mention that they can run the .sh files if they're on linux @guihkx anything missing? i don't think there's more than that tbh |
I don't think anything else is missing. I've added Linux-specific instructions to the "Setting up the environment, building and running" page in this diff (feel free to use/modify it to your liking): diff --git a/Setting-up-the-environment,-building-and-running.md b/Setting-up-the-environment,-building-and-running.md
index dd4e586..ce9409b 100644
--- a/Setting-up-the-environment,-building-and-running.md
+++ b/Setting-up-the-environment,-building-and-running.md
@@ -1,28 +1,64 @@
# Prerequisites
-In order to setup the development environment for the application, you'll need to install both Python and Git. Here are two guides which will help you through the process:
+In order to setup the development environment for the application, you'll need to install both Python and Git.
+
+## Windows
+
+Here are two guides which will help you through the process:
- [Git Installation](https://github.com/DevilXD/TwitchDropsMiner/wiki/Git-Installation)
- [Python Installation](https://github.com/DevilXD/TwitchDropsMiner/wiki/Python-Installation)
Continuing past this point, you should have both of them installed with the configuration and steps explained in each guide, and your computer should be restarted (see the "Final note" section in either of the two guides above for details).
+## Linux
+
+This guide assumes you're on a modern version of a Ubuntu-based Linux distribution. If you're on a different distro, the name of packages used below will likely be different, and you will need to adapt them yourself.
+
+You'll need to install Git (`git`), Python 3 with Tkinter support (`python3-tk`), Python's package installer (`python3-pip`) and Python's virtual environment module (`python3-venv`).
+
+For system tray support, you'll also need Ayatana's AppIndicator (`libayatana-appindicator3-1`), GObject introspection files for Ayatana's AppIndicator (`gir1.2-ayatanaappindicator3-0.1`), Python 3 development headers (`python3-dev`), Cairo 2D development headers (`libcairo2-dev`), Pycairo development headers (`python3-cairo-dev`), GObject introspection data development headers (`libgirepository1.0-dev`), pkgconf (`pkg-config`) and a C compiler (`gcc`).
+
+In one `apt install` command:
+
+```sh
+sudo apt install git python3-tk python3-pip python3-venv libayatana-appindicator3-1 gir1.2-ayatanaappindicator3-0.1 python3-dev libcairo2-dev python3-cairo-dev libgirepository1.0-dev pkg-config gcc
+```
+
# Setup the environment
To setup the runtime environment for the application, first, download the source code. If you're using `git`, you can `git clone https://github.com/DevilXD/TwitchDropsMiner` the project into a folder of choice. Otherwise, you can download the source code from the main project's page by using the button shown below, and then unzip it into a folder of choice.
![code-download](https://user-images.githubusercontent.com/4180725/206105115-5d94e594-9a79-4fda-b6b6-5ed487985208.png)
+## Windows
+
Once you have the source code, run `setup_env.bat`. This will create an `env` folder next to the source code files, and install all required Python packages inside it. Watch out for permission errors, you may need to run it as Administrator.
+## Linux
+
+Once you have the source code, open a terminal window and use the `cd` command to navigate to the location of the source code. After that, run `./setup_env.sh`. This will create an `env` folder next to the source code files, and install all required Python packages inside it.
+
# Running from source
+## Windows
+
Run `run_dev.bat` to start the development build from source code. Starting without a console is perfectly fine, but you may want to start with a console if you'd expect errors to be printed out.
+## Linux
+
+First, run `source ./env/bin/activate` to activate the Python virtual environment. Then, run `python3 main.py` to start the application.
+
# Building an executable
+## Windows
+
If you'd want to build an executable, run `build.bat` - this will create a `dist` folder with the resulting executable inside. PyInstaller will be automatically installed into the environment (`env` folder) on the first build attempt, and thus might require running it as Administrator. Subsequent builds should complete just fine with normal permissions.
+## Linux
+
+If you'd want to build an executable, run `./build.sh` - this will create a `dist` folder with the resulting executable inside. PyInstaller will be automatically installed into the environment (`env` folder) on the first build attempt.
+
# Manual instructions
If you're one of those people who doesn't trust pre-made scripts, or you're interested in doing something those scripts haven't foreseen, here's some quick instructions which can get you up and running. Note that all commands assume you have Python and Git installed - if not, check out the prerequisites section at the top. Also, it's assumed you'll start your command prompt in the source code's directory, setting it as the current working directory.
|
I just noticed @biast12 Can you please do that? |
I can change it but it for some reason won't allow me to commit it :/ |
That's odd... Do you get an error or something? |
Nope, it just doesn't change anything binary wise about the files so github can't see any difference, i just tried to force it but to no avail (gonna rebase it again 2 sec) |
If you want, feel free to add me as a collaborator to your TwitchDropsMiner fork (so I'm given commit access), and I can try to fix it for you. But if you think that's too much work or not worth it, I can do it later in a future PR. And you can remove your last empty commit as well. |
I just added you, pretty sure that's the best and easiest route for us all xD |
Should be good now. I've removed myself as a collaborator too. :p |
Hey @DevilXD, the pr is done / ready to merge if you got time to look at it at some point |
I understand. However, I haven't been able to find enough time to be able to look at this in detail, plus the wiki documentation has to be altered to include the Linux instructions. I'm currently back in work delegation for the rest of this year, so this will need to wait until about the middle of January. I'll try to get to it on my off time soft-scheduled for 27th-Dec to 3rd-Jan, but all stars are currently pointing at the off time not being a thing, and me working through out this time as well. |
Yep all good, just wanted to be sure you hadn't missed it, hope you can get some free time (not just for this but in general also), and I wish you a merry christmas and a happy new year for the time being. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've finally found some free time for this, and already finished doing the wiki page changes. Thank you @guihkx for the diff 🙂
I've also reviewed the changes of this PR, and I have some remarks, which you can find below. Most of them are trivial, but there's two places that would need to be changed for me to approve this. All the details of them can be found in the discussions below.
Also, late Merry Christmas and a Happy upcoming New Year to you =)
Got all the changes ready to commit, do you want me to just do a commit or rebase again? |
Up to you, really. Just so you know, during merging, I rebase changes where the commits history is kept clean, otherwise if the commits are just "Updated twitch.py" (commit messages aren't descriptive), I do a squash and give the merge commit a more descriptive message (usually for translations PRs). Since the commits in this PR are looking great so far, I'll be doing a rebase, so rebasing is preferred to keep everything clean. A commit is fine too, if you don't want to bother though =) |
And that should be it, i just did the commit as it's probably better for all of us 😭 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've taken another look, and I've noticed a couple more things to resolve. Most of them are straight forward consistency changes between the two scripts, like for ex. the shell script including an echo description, while the batch script didn't.
An important thing about the batch script: On Windows, the scripts are usually ran standalone, via double-click. This opens and attaches a separate console window to the script, that closes together with the script finishing at the exit
command. Because of that, to be able to actually "see" any output being printed out for more than a fraction of a second before the console window disappears, the script has to incorporate a pause
command, that pauses the execution until any key is pressed. Without that, those "failed to install ..." lines are pretty much never going to be seen, and the window will just "flash" (open and almost immediately close) without giving the user a change to read anything. The extra echo commands are there to space the messages out a little, as that improves readability.
Fun fact, the echo:
command isn't a real command, it's a hack that makes echo
print nothing, which serves as just printing a new, empty line. Using just echo
prints the current echo status. Any non-special character just after echo
(but without a space) works:
And there, i also changed the "All done!" echo to something a bit more fitting to the consistency of the scripts / "Environment setup completed successfully.", everything should be fine now tho |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good now =)
Improves the bat files
Added bash/.sh files so linux can easily create the env and build too
Added support for building with other architectures too