summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2022-12-31 23:38:19 +0100
committerjaseg <git@jaseg.de>2022-12-31 23:38:19 +0100
commit6e717a277be2893a8d7bafa6b3784cffaf81f17e (patch)
treea019db315e919df069fcce45185698f0cf0fbd32
parent9d5fff7dba42d03d4f6f94d40139cf3dd91c3c52 (diff)
downloadwsdiff-6e717a277be2893a8d7bafa6b3784cffaf81f17e.tar.gz
wsdiff-6e717a277be2893a8d7bafa6b3784cffaf81f17e.tar.bz2
wsdiff-6e717a277be2893a8d7bafa6b3784cffaf81f17e.zip
Prepare package for PyPI upload
-rw-r--r--.gitignore6
-rw-r--r--pyproject.toml25
-rw-r--r--src/wsdiff.py (renamed from html_diff.py)8
3 files changed, 32 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
index 8049d93..bbf2dd5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,3 @@
-index.html
-test/
-venv/
+build
+dist
+**/*.egg-info
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..380cfc2
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,25 @@
+[project]
+name = "wsdiff"
+version = "0.1.0"
+authors = [{name="jaseg", email="code@jaseg.de"}]
+description = "wsdiff is a tool that produces a syntax-highlighted, self-contained, static HTML file that will show a colored, syntax-highlighted diff of two files or folders without external dependencies or javascript."
+requires-python = ">=3.7"
+readme = "README.md"
+classifiers = [
+ "Programming Language :: Python :: 3",
+ "License :: OSI Approved :: MIT License",
+ "Operating System :: OS Independent",
+ ]
+dependencies = ["pygments"]
+
+[project.urls]
+"Source" = "https://git.jaseg.de/wsdiff.git"
+"Bug Tracker" = "https://github.com/jaseg/wsdiff/issues"
+
+[project.scripts]
+wsdiff = "wsdiff:cli"
+
+[build-system]
+requires = ["setuptools>=61.0"]
+build-backend = "setuptools.build_meta"
+
diff --git a/html_diff.py b/src/wsdiff.py
index 0cf9b5c..777c2a5 100644
--- a/html_diff.py
+++ b/src/wsdiff.py
@@ -639,10 +639,8 @@ def html_diff_block(old, new, filename, lexer):
</div>''')
-if __name__ == "__main__":
- description = "Given two source files or directories this application creates an html page that highlights the differences between the two."
-
- parser = argparse.ArgumentParser(description=description)
+def cli():
+ parser = argparse.ArgumentParser(description="Given two source files or directories this application creates an html page that highlights the differences between the two.")
parser.add_argument('-b', '--open', action='store_true', help='Open output file in a browser')
parser.add_argument('-s', '--syntax-css', help='Path to custom Pygments CSS file for code syntax highlighting')
parser.add_argument('-l', '--lexer', help='Manually select pygments lexer (default: guess from filename, use -L to list available lexers.)')
@@ -740,3 +738,5 @@ if __name__ == "__main__":
if args.open:
webbrowser.open('file://' + str(Path(args.output.name).absolute()))
+if __name__ == "__main__":
+ cli()