Working with Docs in Windows using Cygwin¶
The main contribution guide :doc: contributing was built for *nix systems, and the same commands may not work in Windows. Cygwin is a Windows tool, equivalent to *nix bash terminal. This guide helps to set up ODK Docs platform from the default Windows command prompt (CMD).
The following are software tools that you need in the first place. If it is already installed. Just follow the steps and apply what is missing.
- Python 3
- Git and GLFS
These are a set of the main packages. ODK team combined them in a file such that all will be installed at once.
If you encounter any downloading problems, make sure to select a mirror site near you. The entire list is available on the Cygwin website.
Make sure to select the option "Add Python to the Path", as shown below.
Next, make sure to select "pip", which is a package manager < https://pypi.python.org/pypi/pip>_ written in Python. We will use it to install packages. See the following image:
Alternatively, if you forgot to add Python 3 to the PATH, add it manually using the following command:
> set PATH=%PATH%;C:\Users\your username\python3
C:/Users/your username/python3 is the default Python 3 installation PATH. If you change it, please substitute the above path by the new one.
A virtual environment tool creates multiple Pythons environments, each has its packages and dependencies.
For easy installation,
pip command can be used, which comes with Python 3 (as shown in Python installation).
> pip install virtualenv
Create a new directory for your odkdocs work:
> mkdir odk
To work with virtualenv, you have two options:
- Use the native virtualenv.
- Use virtualenvwrapper on the top of virtualenv.
Native Virtual Environment¶
Create a new Python 3 virtual environment, "odkenv" is the name of the virtualenv, you can choose any name.
> virtualenv -p <python path/python.exe> odkenv
After creating the virtualenv, multiple files are copied into the folder odkenv in your working directory.
> ls odkenv
The folder Scripts contains all virtualenv controls as ".bat" files.
To activate the odkenv:
> cd odkenv . . . > cd Scripts > odk/odkenv/Scripts/activate.bat
To deactivate the odkenv:
Virtual Environment Wrapper¶
This step is not an alternative to virtualenv. You must install virtualenv first.
The Virtualenvwrapper <https://pypi.python.org/pypi/virtualenvwrapper-win> mediates between user CMD and virtualenv to ease management and working with multiple virtual environments. To install virtualenvwrapper, use the following:
> pip install virtualenvwrapper-win
Create a new virtualenv:
> mkvirtualenv odkenv
Once the odkenv is created, it is automatically activated:
To deactivate the odkenv, write:
To activate the odkenv:
> workon odkenv
Git and GLFS¶
Install Android Debug Bridge <collect-adb> to learn more about ADB. ADB is part of Android studio, To download
To use ADB, you must run Android Studio once. The default location of ADB is
C:/Users/your username/AppData/Local/Android/sdk/platform-tools. Add it to
Windows PATH by using the following command:
set PATH=%PATH%;C:\Users\your user name\AppData\Local\Android\sdk\platform-tools
Fork and Clone the ODK Docs repo¶
From Github, fork the ODK Docs. This will create a copy of the docs in your Github account called
origin. Move to the ODk working directory, and clone the ODk Docs into your local machine.
> git clone https://github.com/your-github-username/docs.git
Set the Upstream Remote¶
> git remote add upstream https://github.com/getodk/docs.git
Install the Requirements¶
This step will install a bunch of packages that are listed in the :file: requirement.txt file. ODK team prepared this file for you to ease the installation.
First, you need to activate your virtual environment (odkenv):
> workon odkenv
Make sure you are inside the docs folder, then run:
$ pip install -r requirements.txt
You completed the installation and you can start change and build ODK Docs.