Skip to content
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

Windows compatibility changes + Instructions #21

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,84 @@ WARNUNG: NOCH IST DIESE SOFTWARE IN ENTWICKLUNG - ALSO NICHT FÜR DEN PRODUKTIVE

Besser als der HSR Mapper ;)

##How to install
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diesen Teil bitte in /docs/install.md verschieben. Dort gibt es bereits einen Teil für die Installation des Druckers. Ziel ist es, die Installation mittels Pakete oder Installer zu automatisieren.

###Ubuntu/Debian
1. Install dependencies
```
$sudo apt-get install git python3-setuptools gcc python3-dev libffi-dev libssl-dev python3-pip -y
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hier musst du die Code-Blocks einrücken, da sonst Markdown die Nummerierung nicht Checkout (Siehe https://github.com/seroam/connect/blob/master/README.md)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Und ein Space zwischen $ und dem Kommand 😉

2. Clone repo
```
$git clone https://github.com/openhsr/connect.git
$cd connect
```
3. Build & install
```
$sudo python3 ./setup.py install
```
4. Set up sync settings
```
$openhsr-connect edit
```
Enter HSR information, modify config file for your classes (See example [here](https://github.com/openhsr/connect/blob/master/docs/config.example.yaml))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generell würde ich Links nicht mit here oder so benennen, sondern bsp. See example configuration.


5. Profit!
```
$openhsr-connect sync
```
Sync the specified directories with the script server.



###Windows
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hier bitte nich einen Hinweis anbringen, dass Windows nicht offiziell/vollständig unterstützt ist.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bitte in (NOT officially supported) anhängen!

1. Download Python 3.x (Latest is 3.5.2 as of creation of this guide. Download website: [Link](https://www.python.org/downloads/release/python-352/), Installer: [click me hard](https://www.python.org/ftp/python/3.5.2/python-3.5.2-amd64.exe))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link 😉

Install and make sure to install the py launcher as well (this setting should automatically be set in the advanced installation options).

2. Install git
Download link [here](https://git-scm.com/download/win)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here 😉


3. Clone repo
Open admin command prompt
```
$git clone https://github.com/openhsr/connect.git
cd connect
```

4. Build & install
```
$py -3 setup.py install
```

5. Add Python Scripts folder to $PATH
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link 😉

For x64 Python this path is ```C:\Program Files\Python35\Scripts``` by default. If you're not sure how to add this to Path, check this [link](http://www.computerhope.com/issues/ch000549.htm)

6. Set up sync settings
```
$openhsr-connect edit
```
Enter HSR information, modify config file for your classes (See example [here](https://github.com/openhsr/connect/blob/master/docs/config.example.yaml))

7. Profit!
```
$openhsr-connect sync
```
Sync the specified directories with the script server.

###Bash on Ubuntu on Windows
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wann und was ist hier der Unterschied zur "normalen" Windows?!

Follow steps 1-3 from the Ubuntu/Debian section, then:

Download & install keyrings.alt
```
$cd
$curl https://pypi.python.org/packages/27/d0/9207bf58de11735fe2239deaecb9eae1084e2887077a700ac8aa27bd8159/keyrings.alt-1.1.1.tar.gz | tar xz
$cd keyrings.alt-1.1.1
$sudo python3 ./setup.py install
```

Continue with step 4 from the Ubuntu/Debian section.



## Lizenz

```open\HSR Connect``` steht unter der [GNU Public License version 3 (GPLv3)](https://www.gnu.org/licenses/gpl-3.0.html). Eine Kopie der Lizenz ist unter LICENSE.txt abgelegt.
6 changes: 5 additions & 1 deletion docs/config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@ sync:
global-exclude:
- .DS_Store
- Thumbs.db
- desktop.ini

conflict-handling:
local-changes: ask
remote-deleted: ask

default-local-dir: /path/to/your/files/<name>/
default-local-dir: /path/to/your/files/<name>/ #E.g. /home/user/hsr/<name>/

repositories:
InfSi1:
remote-dir: Informatik/Fachbereich/Informationssicherheit_1_-_Grundlagen/InfSi1
exclude:
- '*.exe'
- 'Archiv'
OO:
remote-dir: Informatik\Fachbereich\Objektorientierte_Programmierung\OO

19 changes: 18 additions & 1 deletion openhsr_connect/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import keyring
from .exceptions import PasswordException, ConfigurationException
import jsonschema
import errno

logger = logging.getLogger('openhsr_connect.config')
PATH_CONFIG = '~/.config/openhsr-connect.yaml'
Expand All @@ -19,6 +20,7 @@
global-exclude:
- .DS_Store
- Thumbs.db
- desktop.ini

conflict-handling:
local-changes: ask # ask | keep | overwrite | makeCopy
Expand Down Expand Up @@ -103,10 +105,24 @@ def create_default_config(config_path):
username = input('Dein HSR-Benutzername: ')
mail = input('Deine HSR-Email ([email protected]): ')
config = DEFAULT_CONFIG.format(username=username, mail=mail)
with open(config_path, 'w') as f:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gemäss PEP-8 nur eine leere Zeile


with safe_open_w(config_path) as f:
f.write(config)


#Open file path and create parent directories if necessary as open() doesn't create them on Windows
def safe_open_w(path):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python Methodenkommentare sind unterhalb mit drei "
Also

def safe_open_w(path):
"""
Open file path and create parent directories if necessary as open() doesn't create them on Windows
"""

try:
os.makedirs(os.path.dirname(path))
except OSError as e:
if e.errno == errno.EEXIST and os.path.isdir(os.path.dirname(path)):
pass
else: raise
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

raise auf neue Zeile


return open(path, 'w')

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whitespace bitte löschen


def load_config(raise_if_incomplete=False):
"""
Loads the user configuration and creates the default configuration if it does not yet exist.
Expand All @@ -117,6 +133,7 @@ def load_config(raise_if_incomplete=False):
if not os.path.exists(config_path):
if raise_if_incomplete:
raise ConfigurationException('Configuration does not yet exist!')

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hier bitte den Whitespace löschen.

create_default_config(config_path)

config = None
Expand Down