From 05ef6d3dd923edb4a45c4f5ba016ca4b9101ddfb Mon Sep 17 00:00:00 2001 From: Colin Hughes Date: Sat, 3 Oct 2020 06:26:34 +0100 Subject: [PATCH 1/4] added "Windows user (using PyCharm)" section to README.development --- README.development | 108 +++++++++++++++++++++++++++++++++++++++++++++ requirements.txt | 23 ++++++++++ 2 files changed, 131 insertions(+) create mode 100644 requirements.txt diff --git a/README.development b/README.development index 82b5245c2..c354d8b4c 100644 --- a/README.development +++ b/README.development @@ -153,6 +153,114 @@ User-contributed instructions for building using Cygwin: 1. Do not use `bash run` because it my call for Windows Subsystem for Linux 1. Do not use any Cygwin terminal as `mintty.exe` because the `rust lang` compiler does not work with them +Windows users (using PyCharm) +----------------------------- +These instructions assume Microsoft Python support is not installed; neither via VS nor VS Code nor some other way. + If MS Python support is already installed the process is different, and these notes may not work seamlessly for you. + +These notes are proscriptive, other methods will work (such as a different Bash/Shell). + +While some of this list is in an arbitrary order, significant steps are in a specific order, therefore it is strongly + recommended to follow these instructions step-by-step. + +- Python and PyCharm are a given if you are choosing this path and should be the first and second step respectively. + +- close PyCharm, if it's open. + +- install Node.js (npm installs with nodejs) + +- install Cygwin (check the Cygwin /bin folder is added to System PATH) + +- use the Visual Studio Community installer to install: + - the individual C++ Clang Compiler for Windows (10.0.0) component. + - the Python development Workflow + +- install rustup (https://rustup.rs/) + +- download and install Strawberry Perl msi from http://strawberryperl.com/ + - this is the installer at the time of writing these notes: + http://strawberryperl.com/download/5.32.0.1/strawberry-perl-5.32.0.1-64bit.msi + +- mpv isn't required unless you are developing against mpv (Anki will revert to Mplayer) + - open an elevated Git Bash (elevated to "Run as administrator") + - choco install mpv + - assumes you have Chocolatey installed + +- install Git and Git Bash (this delivers curl too) + - add git/usr/bin to your System PATH before cygwin/bin folder, mentioned above. + - run: + - git config --global core.autocrlf + - make a note of the result (referred to as [yourLineEndingsValue] later in these notes) + - if the [yourLineEndingsValue] is not 'input', run (to preserve Anki's Unix line endings): + - git config --global core.autocrlf input + - run: + - cargo install ripgrep + +- got to https://github.com/protocolbuffers/protobuf/releases + - download latest protoc-v.v.v-win64.zip where 'v' is replaced with version numbers + - this is the file at the time of writing these notes: + https://github.com/protocolbuffers/protobuf/releases/download/v3.13.0/protoc-3.13.0-win64.zip + - extract bin\protoc.exe to C:\Program Files\Git\usr\bin (or where ever you installed Git and Git Bash above) + +- go to http://repo.msys2.org/msys/x86_64/ + - download latest rsync-v.v.v-v-x86_64.pkg.tar.xz where 'v' is replaced with version numbers + - this is the file at the time of writing these notes: + http://repo.msys2.org/msys/x86_64/rsync-3.1.3-1-x86_64.pkg.tar.xz + - extract the tar, then extract usr\bin\rsync.exe to c:\Program Files\Git\usr\bin as for protoc.exe above + +- clone your GitHub Anki fork to a local folder + +- open that local Anki source folder in PyCharm + +- default PyCharm Terminal to Git Bash: + - these steps aren't required, you can just use Git Bash externally to run Anki and the commands below, if you + prefer + - open Anki project in PyCharm + - open File > Settings + - navigate to Tools > Terminal + - set Shell path to: "C:\Program Files\Git\bin\bash.exe" (or where ever you installed Git and Git Bash) + - restart PyCharm with Anki project + +- open PyCharm Terminal (Git Bash) + +- set your local Anki project to preserve unix line endings: + - git config --local core.autocrlf input +- if [yourLineEndingsValue] was not 'input', revert global line endings: + - git config --global core.autocrlf [yourLineEndingsValue] + - e.g. (most likely): + - git config --global core.autocrlf true + +- ensure your virtual environment is set up as you like it to be + - don't forget to add the virtual environment & .idea folders to your global (not local) .gitignore if you haven't + already + +- run these three commands: + - pip install -r qt/requirements.qt + - pip install -r requirements.txt + - pipwin install pyaudio + + - note if requirements.txt isn't available see "- to manually install requirements:" below + +- in PyCharm + - either: + - open Terminal (Git Bash) + - type ./run + - or: + - right click 'run' file in Anki project root and click the command to run it + - watch the magic happen (it takes a while and there are a couple of long pauses). + +- to manually install requirements: + - use Git Bash within your local root Anki folder to run these commands: + - for portaudio: + - pip install pipwin + - pipwin install pyaudio + - pip install lameenc + - pip install py-make + - pip install python-gettext + +please note: these instructions have been based off the general notes above and the notes for installing for Windows + using Visual Studio. Without those notes this section would have been very difficult, if not impossible. + Enviromental Variables ----------------------- diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..0fe41e8c7 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,23 @@ +autopep8==1.5.2 +beautifulsoup4==4.9.2 +certifi==2020.6.20 +chardet==3.0.4 +docopt==0.6.2 +idna==2.10 +Js2Py==0.70 +lameenc==1.2.2 +packaging==20.4 +pipwin==0.5.0 +py-make==0.1.1 +pycodestyle==2.6.0 +pyjsparser==2.7.1 +pyparsing==2.4.7 +PyPrind==2.11.2 +pySmartDL==1.3.4 +python-gettext==4.0 +pytz==2020.1 +requests==2.24.0 +six==1.15.0 +soupsieve==2.0.1 +tzlocal==2.1 +urllib3==1.25.10 From 71d7131af7e922a84bee58cdabacf1f4bf7103fd Mon Sep 17 00:00:00 2001 From: lukkea Date: Mon, 5 Oct 2020 08:47:20 +0100 Subject: [PATCH 2/4] stripped out requirements.txt to only those not already included --- requirements.txt | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/requirements.txt b/requirements.txt index 0fe41e8c7..a9fe95276 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,23 +1,4 @@ -autopep8==1.5.2 -beautifulsoup4==4.9.2 -certifi==2020.6.20 -chardet==3.0.4 -docopt==0.6.2 -idna==2.10 -Js2Py==0.70 lameenc==1.2.2 -packaging==20.4 pipwin==0.5.0 py-make==0.1.1 -pycodestyle==2.6.0 -pyjsparser==2.7.1 -pyparsing==2.4.7 -PyPrind==2.11.2 -pySmartDL==1.3.4 python-gettext==4.0 -pytz==2020.1 -requests==2.24.0 -six==1.15.0 -soupsieve==2.0.1 -tzlocal==2.1 -urllib3==1.25.10 From 41d0b7ddca33ed0ec58d93eefa0c948881a9a107 Mon Sep 17 00:00:00 2001 From: lukkea Date: Fri, 9 Oct 2020 10:19:54 +0100 Subject: [PATCH 3/4] removed requirements.txt and adjusted "Windows users (using PyCharm)" to reflect that removal --- README.development | 28 +++++++++++----------------- requirements.txt | 4 ---- 2 files changed, 11 insertions(+), 21 deletions(-) delete mode 100644 requirements.txt diff --git a/README.development b/README.development index c354d8b4c..5cd8791a5 100644 --- a/README.development +++ b/README.development @@ -208,6 +208,11 @@ While some of this list is in an arbitrary order, significant steps are in a spe http://repo.msys2.org/msys/x86_64/rsync-3.1.3-1-x86_64.pkg.tar.xz - extract the tar, then extract usr\bin\rsync.exe to c:\Program Files\Git\usr\bin as for protoc.exe above +- install remaining dependencies to Python packages + - pip install https://github.com/ankitects/windows-ci-tools/PyAudio-0.2.11-cp37-cp37-win_amd64.whl + - pip install lameenc + - pip install python-gettext + - clone your GitHub Anki fork to a local folder - open that local Anki source folder in PyCharm @@ -231,15 +236,13 @@ While some of this list is in an arbitrary order, significant steps are in a spe - git config --global core.autocrlf true - ensure your virtual environment is set up as you like it to be - - don't forget to add the virtual environment & .idea folders to your global (not local) .gitignore if you haven't - already + - if you don't set the virtual environment to pyenv (Anki's virtual environment folder) don't forget to add the + virtual environment folder to your global (not local) .gitignore if you haven't already. -- run these three commands: +- add .idea folder to .gitignore + +- from project root run: - pip install -r qt/requirements.qt - - pip install -r requirements.txt - - pipwin install pyaudio - - - note if requirements.txt isn't available see "- to manually install requirements:" below - in PyCharm - either: @@ -249,19 +252,10 @@ While some of this list is in an arbitrary order, significant steps are in a spe - right click 'run' file in Anki project root and click the command to run it - watch the magic happen (it takes a while and there are a couple of long pauses). -- to manually install requirements: - - use Git Bash within your local root Anki folder to run these commands: - - for portaudio: - - pip install pipwin - - pipwin install pyaudio - - pip install lameenc - - pip install py-make - - pip install python-gettext - please note: these instructions have been based off the general notes above and the notes for installing for Windows using Visual Studio. Without those notes this section would have been very difficult, if not impossible. -Enviromental Variables +Environmental Variables ----------------------- If ANKIDEV is set before starting Anki, some extra log messages will be printed on stdout, diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index a9fe95276..000000000 --- a/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -lameenc==1.2.2 -pipwin==0.5.0 -py-make==0.1.1 -python-gettext==4.0 From d367044da2cb31dce5569d8725dc7497e5493de0 Mon Sep 17 00:00:00 2001 From: lukkea Date: Fri, 9 Oct 2020 11:37:04 +0100 Subject: [PATCH 4/4] clarified that .idea folder should be added to global .gitignore, not the repo .gitignore --- README.development | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.development b/README.development index 5cd8791a5..5ffbe803c 100644 --- a/README.development +++ b/README.development @@ -239,7 +239,7 @@ While some of this list is in an arbitrary order, significant steps are in a spe - if you don't set the virtual environment to pyenv (Anki's virtual environment folder) don't forget to add the virtual environment folder to your global (not local) .gitignore if you haven't already. -- add .idea folder to .gitignore +- add .idea folder to your global .gitignore (not the local .gitignore in the cloned repo) - from project root run: - pip install -r qt/requirements.qt