From dcb9e8ce779aea39370dbfee9b49d33667313ddd Mon Sep 17 00:00:00 2001 From: Kris Lamoureux Date: Tue, 18 Jul 2023 04:03:49 -0400 Subject: [PATCH] The bare minimum to upgrade to Python 3 --- .gitignore | 21 ++++++--------------- Makefile | 6 ------ README.md | 29 ++++++++--------------------- dicekey/{dicekey => main.py} | 12 ++++++------ setup.py | 23 +++++++++++++---------- 5 files changed, 33 insertions(+), 58 deletions(-) delete mode 100644 Makefile rename dicekey/{dicekey => main.py} (86%) mode change 100644 => 100755 diff --git a/.gitignore b/.gitignore index 81c437e..b61d3c1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,6 @@ -######### -# Python -######### -*.pyc - -build - -######### -# Debian -######### -*.deb -backup-*.tgz -description-pak - -doc-pak +*.egg-info/ +.env +env +*/__pycache__/* +.venv +venv diff --git a/Makefile b/Makefile deleted file mode 100644 index 8906c90..0000000 --- a/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -install: - python setup.py build - sudo checkinstall -Dy --fstrans=no python setup.py install - -clean: - sudo rm -r build *-pak dicekey_*.deb diff --git a/README.md b/README.md index c95542f..5cae5f0 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,19 @@ # Dicekey -Dicekey is a [Diceware](http://diceware.com) passphrase generator that aims -to be user friendly and encourage the adoption of strong random passphrases. +Dicekey is a [Diceware](http://diceware.com) simple Python passphrase generator. ## Quick Start -Instructions on how to install from the git repository for developers. - -* Clone the repository: `git clone https://github.com/Kris619/Dicekey.git` -* Install dependencies: `sudo apt-get install python-tk checkinstall` -* Install Dicekey with GNU make: `make install` -* Clean up files: `make clean` - -To uninstall Dicekey: `sudo dpkg -r dicekey` - -## Development - -Dicekey is developed on Trisquel GNU/Linux 7 x86_64 with Python 2.7.6 -and checkinstall 1.6.2. There *are* plans to support other platforms. - -Development follows the the [Semantic -Versioning](http://semver.org/spec/v2.0.0.html) 2.0.0 specification and the -[PEP 8](https://www.python.org/dev/peps/pep-0008/) styling guide. Mistakes may -occur but we shall try to follow these guidelines to the best of our ability. +1. Clone the repository: `git clone https://git.krislamo.org/kris/dicekey` +2. Install dependencies: `sudo apt-get install python-tk` +3. Create a virtual environment: `python3 -m venv .venv` +4. Activate the virtual environment `source .venv/bin/activate` +5. Install package: `pip install -e .` +6. Run `dicekey` and optionally specify a length, i.e., `dicekey 7` ## Copyrights and Licenses -Copyright (C) 2016 Kris Lamoureux +Copyright (C) 2016, 2023 Kris Lamoureux All Dicekey code is [Free Software](https://www.gnu.org/philosophy/free-sw.en.html) diff --git a/dicekey/dicekey b/dicekey/main.py old mode 100644 new mode 100755 similarity index 86% rename from dicekey/dicekey rename to dicekey/main.py index 33f0c60..af354fb --- a/dicekey/dicekey +++ b/dicekey/main.py @@ -1,7 +1,7 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Dicekey. A Diceware passphrase generator. -# Copyright (C) 2016 Kris Lamoureux +# Copyright (C) 2016, 2023 Kris Lamoureux # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ # Built-in import sys -import Tkinter as tk +import tkinter as tk # Local from dicekey import diceware @@ -47,12 +47,12 @@ def main(): if len(sys.argv) > 1: if wordlist: if sys.argv[1].isdigit(): - print ' '.join(pwgen.wordgen(int(sys.argv[1]))) + print(' '.join(pwgen.wordgen(int(sys.argv[1])))) else: error = "Error: Argument '%s' is not an integer." - print error % (sys.argv[1]) + print(error % (sys.argv[1])) else: - print "Error: Incomplete or missing word list." + print("Error: Incomplete or missing word list.") else: root = tk.Tk() diff --git a/setup.py b/setup.py index 78ab6ee..9eb8184 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,5 @@ # Dicekey. A Diceware passphrase generator. -# Copyright (C) 2016 Kris Lamoureux +# Copyright (C) 2016, 2023 Kris Lamoureux # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,14 +13,13 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Built-in -from distutils.core import setup +from setuptools import setup -NAME = "Dicekey" -VERSION = "3.1.0-prealpha" +NAME = "dicekey" +VERSION = "0.0.1" AUTHOR = "Kris Lamoureux" -AUTHOR_EMAIL = "KrisPublicEmail@gmail.com" -URL = "https://github.com/Kris619/Dicekey/" +AUTHOR_EMAIL = "kris@lamoureux.io" +URL = "https://git.krislamo.org/kris/dicekey" DESCRIPTION = "A Diceware passphrase generator" setup( @@ -31,7 +30,11 @@ setup( author_email=AUTHOR_EMAIL, license="GNU GPLv3", url=URL, - scripts = ["dicekey/dicekey"], py_modules = ["dicekey.diceware"], - data_files = [("dicekey/wordlist.asc", '')] - ) + data_files = [("dicekey/wordlist.asc", '')], + entry_points={ + 'console_scripts': [ + 'dicekey = dicekey.main:main', + ], + }, +)