Commit a5b8402c by Paul Kilgo

install scripts using setuptools

- lookup.py was deprecated in favor of setuptools entry_points; the code for
  lookup.py was moved to django_sshkey.util.lookup_main
- lookup.sh was renamed to django-sshkey-lookup since setuptools retains the
  names of scripts once installed. A symlink has been left in place.
parent 5952c1e6
...@@ -4,6 +4,7 @@ include COPYING.LESSER ...@@ -4,6 +4,7 @@ include COPYING.LESSER
include README.md include README.md
include lookup.py include lookup.py
include lookup.sh include lookup.sh
include django-sshkey-lookup
include openssh-6.2p2-authorized-keys-command-stdin.diff include openssh-6.2p2-authorized-keys-command-stdin.diff
recursive-include django_sshkey/management *.py recursive-include django_sshkey/management *.py
recursive-include django_sshkey/migrations *.py recursive-include django_sshkey/migrations *.py
......
...@@ -51,9 +51,9 @@ In all cases it is recommended and/or required that the command specified with ...@@ -51,9 +51,9 @@ In all cases it is recommended and/or required that the command specified with
AuthorizedKeysCommand be a shell script that is owned by and only writable by AuthorizedKeysCommand be a shell script that is owned by and only writable by
root which invokes one of the commands below: root which invokes one of the commands below:
## Using lookup.sh ## Using django-sshkey-lookup
*Usage: lookup.sh URL [USERNAME]* *Usage: django-sshkey-lookup URL [USERNAME]*
URL should be the full URL to /sshkey/lookup on your Django web server running URL should be the full URL to /sshkey/lookup on your Django web server running
the sshkey app. the sshkey app.
...@@ -67,15 +67,23 @@ standard input; if the key is found it is printed to standard output. ...@@ -67,15 +67,23 @@ standard input; if the key is found it is printed to standard output.
This command assumes that some fairly standard commands, like ssh-keygen and This command assumes that some fairly standard commands, like ssh-keygen and
curl, are found in $PATH. curl, are found in $PATH.
This command is equivalent to the old script `lookup.sh` but was renamed to
have a less ambiguous name when installed system-wide. A symlink is left in
its place for backwards compatibility.
This is generally the fastest method. This is generally the fastest method.
## Using lookup.py ## Using django-sshkey-pylookup
*Usage: lookup.py URL [USERNAME]* *Usage: django-sshkey-pylookup URL [USERNAME]*
Same as above, but it's all written in Python and doesn't rely on external Same as above, but it's all written in Python and doesn't rely on external
commands. commands.
This script is generated by setuptools when this package is installed. The old
equivalent, `lookup.py` is available with a deprecation warning for backwards
compatibility.
The parent directory of the django\_sshkey app must be in PYTHONPATH. The parent directory of the django\_sshkey app must be in PYTHONPATH.
This is generally the second fastest method. This is generally the second fastest method.
......
...@@ -38,3 +38,7 @@ def lookup_command(args): ...@@ -38,3 +38,7 @@ def lookup_command(args):
status = 0 status = 0
sys.stdout.write(line) sys.stdout.write(line)
sys.exit(status) sys.exit(status)
def lookup_main():
import sys
lookup_command(sys.argv[1:])
...@@ -16,7 +16,9 @@ ...@@ -16,7 +16,9 @@
# You should have received a copy of the GNU Lesser General Public License # You should have received a copy of the GNU Lesser General Public License
# along with django-sshkey. If not, see <http://www.gnu.org/licenses/>. # along with django-sshkey. If not, see <http://www.gnu.org/licenses/>.
import warnings
import django_sshkey.util import django_sshkey.util
import sys
django_sshkey.util.lookup_command(sys.argv[1:]) warnings.warn("lookup.py is deprecated; use django-sshkey-pylookup",
DeprecationWarning)
django_sshkey.util.lookup_main()
django-sshkey-lookup
\ No newline at end of file
...@@ -31,4 +31,12 @@ setup( ...@@ -31,4 +31,12 @@ setup(
'Topic :: Internet :: WWW/HTTP', 'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content', 'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
], ],
scripts=[
'django-sshkey-lookup',
],
entry_points={
'console_scripts': [
'django-sshkey-pylookup = django_sshkey.util:lookup_main',
],
},
) )
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment