]> git.armaanb.net Git - lightcards.git/commitdiff
Restructure root and remove Makefile
authorArmaan Bhojwani <me@armaanb.net>
Mon, 1 Feb 2021 18:26:04 +0000 (13:26 -0500)
committerArmaan Bhojwani <me@armaanb.net>
Mon, 1 Feb 2021 18:26:04 +0000 (13:26 -0500)
Use setuptools for everything

Makefile [deleted file]
README.md
bin/kvtml2html.py [new file with mode: 0755]
bin/lightcards [new file with mode: 0755]
contrib/kvtml2html.py [deleted file]
lightcards.sh [deleted file]
setup.py

diff --git a/Makefile b/Makefile
deleted file mode 100644 (file)
index a126ed9..0000000
--- a/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-.DEFAULT_GOAL := local
-
-global:
-       pip install .
-       mkdir -p /usr/share/man/man1/
-       cp man/lightcards.1 ~/.local/share/man/man1/
-       cp ./lightcards.sh /usr/local/bin/lightcards
-
-local:
-       pip install .
-       mkdir -p ~/.local/share/man/man1/
-       cp man/lightcards.1 ~/.local/share/man/man1/
-       cp ./lightcards.sh ~/.local/bin/lightcards
-
-global-uninstall:
-       pip uninstall lightcards
-       rm /usr/local/bin/lightcards
-
-local-uninstall:
-       pip uninstall lightcards
-       rm ~/.local/bin/lightcards
index 8c7ebd73b6a44cb4c0fc2c1a874ee4f69517a62d..9bc7879b87a73b2caa46a853538a07433b454ac7 100644 (file)
--- a/README.md
+++ b/README.md
@@ -2,9 +2,16 @@
 Terminal flashcards from Markdown.
 
 ## Installation
-Switch to newest version: `git checkout $(git tag | tail -n 1)`, or use the current development state.
+### From PyPI
+`pip install lightcards`
 
-`make` to install for the current user, or `make global` to install for the whole system.
+### From Git
+```
+git clone https://git.sr.ht/~armaan/lightcards
+cd lightcards
+git checkout $(git tag | tail -n 1) # Don't include to use development version
+`pip install .`
+```
 
 ## Usage
 see `lightcards --help`
diff --git a/bin/kvtml2html.py b/bin/kvtml2html.py
new file mode 100755 (executable)
index 0000000..313a44b
--- /dev/null
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+# Converts .kvtml KWordQuiz files to HTML
+
+import argparse
+from bs4 import BeautifulSoup
+
+
+def parse_args():
+    parser = argparse.ArgumentParser(
+        description="Convert KWordQuiz file into Markdown for Lightcards")
+    parser.add_argument("inp", metavar="input file", type=str, nargs=1)
+    parser.add_argument("outp", metavar="output file", type=str, nargs=1)
+    return parser.parse_args()
+
+
+def main():
+    args = parse_args()
+    with open(args.inp[0], "r", encoding="utf-8") as input_file:
+        soup = BeautifulSoup(input_file, "lxml")
+
+    headers = [x.get_text().split("\n")[1] for x in soup.find_all("identifier")]
+    body = soup.find_all("entry")
+    col1 = [x.find("translation", {"id": "0"}) for x in body]
+    col2 = [x.find("translation", {"id": "1"}) for x in body]
+
+    html = f"<html><table><tr><th>{headers[0]}</th><th>{headers[1]}</th></tr>"
+    for i in range(len(col1)):
+        try:
+            html += f"<html><table><tr><td>{col1[i].get_text().rstrip()}</td>"
+            html += f"<td>{col2[i].get_text().rstrip()}</td></tr>"
+        except:
+            pass
+
+    with open(args.outp[0], "w", encoding="utf-8") as output_file:
+        output_file.write(html)
+
+if __name__ == "__main__":
+    main()
diff --git a/bin/lightcards b/bin/lightcards
new file mode 100755 (executable)
index 0000000..10a1657
--- /dev/null
@@ -0,0 +1,2 @@
+#!/usr/bin/env sh
+python3 -m lightcards ${@}
diff --git a/contrib/kvtml2html.py b/contrib/kvtml2html.py
deleted file mode 100755 (executable)
index 313a44b..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env python
-# Converts .kvtml KWordQuiz files to HTML
-
-import argparse
-from bs4 import BeautifulSoup
-
-
-def parse_args():
-    parser = argparse.ArgumentParser(
-        description="Convert KWordQuiz file into Markdown for Lightcards")
-    parser.add_argument("inp", metavar="input file", type=str, nargs=1)
-    parser.add_argument("outp", metavar="output file", type=str, nargs=1)
-    return parser.parse_args()
-
-
-def main():
-    args = parse_args()
-    with open(args.inp[0], "r", encoding="utf-8") as input_file:
-        soup = BeautifulSoup(input_file, "lxml")
-
-    headers = [x.get_text().split("\n")[1] for x in soup.find_all("identifier")]
-    body = soup.find_all("entry")
-    col1 = [x.find("translation", {"id": "0"}) for x in body]
-    col2 = [x.find("translation", {"id": "1"}) for x in body]
-
-    html = f"<html><table><tr><th>{headers[0]}</th><th>{headers[1]}</th></tr>"
-    for i in range(len(col1)):
-        try:
-            html += f"<html><table><tr><td>{col1[i].get_text().rstrip()}</td>"
-            html += f"<td>{col2[i].get_text().rstrip()}</td></tr>"
-        except:
-            pass
-
-    with open(args.outp[0], "w", encoding="utf-8") as output_file:
-        output_file.write(html)
-
-if __name__ == "__main__":
-    main()
diff --git a/lightcards.sh b/lightcards.sh
deleted file mode 100755 (executable)
index 10a1657..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/env sh
-python3 -m lightcards ${@}
index b75e9757b29085176cfd87718c3b588ca43417be..830e579dbd87bcacf9e82dfe02326f58d9b1bf14 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -17,6 +17,8 @@ setup(
     license="MIT",
     packages=["lightcards"],
     install_requires=["beautifulsoup4", "markdown"],
+    data_files=[("man/man1", ["man/lightcards.1"])],
+    scripts=['bin/lightcards'],
     classifiers=[
         "Development Status :: 4 - Beta",
         "Intended Audience :: Other Audience",