Improve virtualenv and installation
This commit is contained in:
parent
0b599cfd37
commit
62c393ffe3
1
.gitignore
vendored
1
.gitignore
vendored
@ -73,3 +73,4 @@ virtualenv_run/
|
||||
src/vendor/
|
||||
src/libusb-1.0.dylib
|
||||
*.pyc
|
||||
venv
|
||||
|
Before Width: | Height: | Size: 239 KiB After Width: | Height: | Size: 239 KiB |
70
Makefile
70
Makefile
@ -1,51 +1,47 @@
|
||||
.PHONY: default
|
||||
default: run
|
||||
|
||||
# Simple execution of the workflow to see all results
|
||||
.PHONY: run
|
||||
run: install-requirements
|
||||
./src/main.py
|
||||
.PHONY: build
|
||||
build: venv install-ports
|
||||
|
||||
# Runs workflow and prompts for Yubikey password
|
||||
.PHONY: set-password
|
||||
set-password: install-requirements
|
||||
./src/main.py set-password
|
||||
.PHONY: install
|
||||
install: venv
|
||||
./replace-workflow.sh
|
||||
|
||||
.PHONY: install-requirements
|
||||
install-requirements: src/vendor src/libusb-1.0.dylib
|
||||
|
||||
# Installs libusb from /opt/local, where MacPorts installs it
|
||||
src/libusb-1.0.dylib:
|
||||
cp /opt/local/lib/libusb-1.0.dylib ./src/
|
||||
|
||||
# Installs 3rd party packages into vendor directory
|
||||
src/vendor:
|
||||
mkdir -p .pip-cache
|
||||
pip install -r ./requirements.txt -t ./src/vendor --cache-dir .pip-cache
|
||||
cp vendor.py src/vendor/__init__.py
|
||||
|
||||
# Creates virtualenv for testing using MacPorts Python
|
||||
virtualenv:
|
||||
virtualenv --python=/opt/local/bin/python2.7 virtualenv
|
||||
./virtualenv_run/bin/pip install -r ./requirements.txt
|
||||
|
||||
# Runs workflow using virtualenv Python
|
||||
.PHONY: virtualenv_run
|
||||
virtualenv_run: virtualenv
|
||||
./virtualenv/bin/python src/main.py
|
||||
|
||||
# Clears the virtualenv and other installed files
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -fr virtualenv src/vendor src/libusb-1.0.dylib
|
||||
find . -name '*.pyc' -delete
|
||||
find . -name '__pycache__' -delete
|
||||
Yauth.alfredWorkflow: venv
|
||||
mkdir Yauth.alfredWorkflow
|
||||
cp -r alfred_yauth Yauth.alfredworkflow/
|
||||
cp -r venv Yauth.alfredWorkflow/
|
||||
cp info.plist Yauth.alfredWorkflow/
|
||||
cp icon.png Yauth.alfredWorkflow/
|
||||
|
||||
# Installs required MacPorts
|
||||
.PHONY: install-ports
|
||||
install-ports:
|
||||
sudo port install swig swig-python ykpers libu2f-host libusb
|
||||
|
||||
# Creates venv using MacPorts Python (Required for it to refrence libusb)
|
||||
venv:
|
||||
virtualenv --python=/opt/local/bin/python2.7 venv
|
||||
./venv/bin/pip install -r ./requirements.txt
|
||||
|
||||
# Simple execution of the workflow to see all results
|
||||
.PHONY: run
|
||||
run: venv
|
||||
@./venv/bin/python -m alfred_yauth.main
|
||||
|
||||
# Runs workflow and prompts for Yubikey password
|
||||
.PHONY: set-password
|
||||
set-password: venv
|
||||
@./venv/bin/python -m alfred_yauth.main set-password
|
||||
|
||||
# Clears the virtualenv and other installed files
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -fr venv Yauth.alfredWorkflow
|
||||
find . -name '*.pyc' -delete
|
||||
find . -name '__pycache__' -delete
|
||||
|
||||
# Install precommit hooks
|
||||
.PHONY: intall-hooks
|
||||
install-hooks:
|
||||
|
34
README.md
34
README.md
@ -1,19 +1,37 @@
|
||||
Alfred Yubico Auth
|
||||
==================
|
||||
# Alfred Yubico Auth
|
||||
|
||||
An Alfred Workflow for auto filling authentication codes stored on your Yubikey.
|
||||
|
||||
Notes
|
||||
-----
|
||||
## Notes
|
||||
|
||||
This is definitely a work in progress. There are a lot of rough edges yet to be polished, but here it goes.
|
||||
|
||||
* Requires some to be installed with a package manager
|
||||
* There is no way to input your key password through the UI yet. Do that with `make set-password` and then it should work fine.
|
||||
* Does not bundle dylibs for you. Hanve't quite figured out what needs to be done to make this portable
|
||||
* Requires MacPorts to install dependencies
|
||||
* Error handling is terrible right now. If things don't work, check the debug log in Alfred
|
||||
|
||||
Credits
|
||||
-------
|
||||
## Installation
|
||||
|
||||
Clone this repo
|
||||
|
||||
```bash
|
||||
git clone https://git.iamthefij.com/iamthefij/alfred-yubico-auth.git
|
||||
```
|
||||
|
||||
Either install your dependencies manually or, if you have MacPorts, you can use:
|
||||
|
||||
```bash
|
||||
make install-ports
|
||||
```
|
||||
|
||||
Otherwise you need to install `swig swig-python ykpers libu2f-host libusb` some other way.
|
||||
|
||||
Finally up the virtualenv and install to your Alfred with
|
||||
|
||||
```bash
|
||||
make install
|
||||
```
|
||||
|
||||
## Credits
|
||||
|
||||
Uses the amazing [deanishe/alfred-workflow](https://github.com/deanishe/alfred-workflow) package
|
||||
|
0
alfred_yauth/__init__.py
Normal file
0
alfred_yauth/__init__.py
Normal file
@ -13,8 +13,6 @@ from ykman.util import derive_key
|
||||
from ykman.util import parse_b32_key
|
||||
from ykman.util import TRANSPORT
|
||||
|
||||
import vendor # noqa
|
||||
|
||||
NON_FEATURE_CAPABILITIES = [CAPABILITY.CCID, CAPABILITY.NFC]
|
||||
|
||||
|
3
src/main.py → alfred_yauth/main.py
Executable file → Normal file
3
src/main.py → alfred_yauth/main.py
Executable file → Normal file
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
from getpass import getpass
|
||||
@ -108,7 +107,7 @@ class YubicoAuth(Workflow3):
|
||||
command_action = None
|
||||
if command == 'set-password':
|
||||
command_action = self.ask_yubikey_password
|
||||
if command == 'list':
|
||||
elif command == 'list':
|
||||
command_action = self.list_credentials
|
||||
else:
|
||||
command_action = self.refresh_credentials
|
Before Width: | Height: | Size: 239 KiB After Width: | Height: | Size: 239 KiB |
@ -92,6 +92,23 @@
|
||||
<string>Yubico Auth</string>
|
||||
<key>objects</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>config</key>
|
||||
<dict>
|
||||
<key>autopaste</key>
|
||||
<false/>
|
||||
<key>clipboardtext</key>
|
||||
<string>{query}</string>
|
||||
<key>transient</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>type</key>
|
||||
<string>alfred.workflow.output.clipboard</string>
|
||||
<key>uid</key>
|
||||
<string>9F48DDE6-BBE7-42ED-ABE5-C9255C92F1CD</string>
|
||||
<key>version</key>
|
||||
<integer>2</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>config</key>
|
||||
<dict>
|
||||
@ -113,23 +130,6 @@
|
||||
<key>version</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>config</key>
|
||||
<dict>
|
||||
<key>autopaste</key>
|
||||
<false/>
|
||||
<key>clipboardtext</key>
|
||||
<string>{query}</string>
|
||||
<key>transient</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>type</key>
|
||||
<string>alfred.workflow.output.clipboard</string>
|
||||
<key>uid</key>
|
||||
<string>9F48DDE6-BBE7-42ED-ABE5-C9255C92F1CD</string>
|
||||
<key>version</key>
|
||||
<integer>2</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>config</key>
|
||||
<dict>
|
||||
@ -173,6 +173,8 @@
|
||||
<dict>
|
||||
<key>alfredfiltersresults</key>
|
||||
<true/>
|
||||
<key>alfredfiltersresultsmatchmode</key>
|
||||
<integer>0</integer>
|
||||
<key>argumenttrimmode</key>
|
||||
<integer>0</integer>
|
||||
<key>argumenttype</key>
|
||||
@ -192,7 +194,7 @@
|
||||
<key>runningsubtext</key>
|
||||
<string></string>
|
||||
<key>script</key>
|
||||
<string>python main.py</string>
|
||||
<string>./venv/bin/python -m alfred_yauth.main</string>
|
||||
<key>scriptargtype</key>
|
||||
<integer>1</integer>
|
||||
<key>scriptfile</key>
|
||||
@ -202,7 +204,7 @@
|
||||
<key>title</key>
|
||||
<string>Yubikey 2FA</string>
|
||||
<key>type</key>
|
||||
<integer>8</integer>
|
||||
<integer>0</integer>
|
||||
<key>withspace</key>
|
||||
<true/>
|
||||
</dict>
|
8
replace-workflow.sh
Executable file
8
replace-workflow.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#! /bin/bash
|
||||
set -e
|
||||
|
||||
echo "Warning! This will remove the workflow at the provided path and replace it with a link to this directory"
|
||||
read -p "Path to workflow to replace: " existing_workflow
|
||||
|
||||
rm -fr "$existing_workflow"
|
||||
ln -s `pwd` "$existing_workflow"
|
@ -1,4 +1,4 @@
|
||||
#! /bin/bash
|
||||
|
||||
echo "$1" > ./src/version
|
||||
plutil -replace version -string "$1" ./src/info.plist
|
||||
echo "$1" > ./alfred_yauth/version
|
||||
plutil -replace version -string "$1" ./info.plist
|
||||
|
Loading…
Reference in New Issue
Block a user