aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Gräf <romangraef@loves.dicksinhisan.us>2020-06-21 02:44:06 +0200
committerRoman Gräf <romangraef@loves.dicksinhisan.us>2020-06-21 02:44:06 +0200
commit090b44edd8bf42e3d9574680dfa2e27cae8e595e (patch)
treec04a9bd456984218d84e7e4c5bb41c44055fff42
parenta23529ccbd1237db2e7cbf5a8075437461fb5abe (diff)
downloadtabsvsspaces-090b44edd8bf42e3d9574680dfa2e27cae8e595e.tar.gz
tabsvsspaces-090b44edd8bf42e3d9574680dfa2e27cae8e595e.tar.bz2
tabsvsspaces-090b44edd8bf42e3d9574680dfa2e27cae8e595e.zip
pypi release
-rw-r--r--.gitignore2
-rw-r--r--README.md15
-rw-r--r--pkg/ins.sc31
-rw-r--r--setup.py34
-rw-r--r--tabsvsspaces/__init__.py4
-rw-r--r--tabsvsspaces/__main__.py4
-rw-r--r--[-rwxr-xr-x]tabsvsspaces/_main.py (renamed from main.py)18
-rw-r--r--tabsvsspaces/pathtype.py (renamed from lib/argparse/pathtype.py)0
-rw-r--r--tabsvsspaces/print_stats.py (renamed from lib/print_stats.py)2
-rw-r--r--tabsvsspaces/stats.py (renamed from lib/stats.py)0
10 files changed, 62 insertions, 48 deletions
diff --git a/.gitignore b/.gitignore
index e265113..ee9b02d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
report
venv/
+dist/
+build/
diff --git a/README.md b/README.md
index d41c973..f8df54a 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,10 @@
## Tabs Vs Spaces
+Use this tool to count the amount of spaces versus the amount of tabs in your codebase.
### Setup
```bash
-git clone https://github.com/romangraef/tabsvsspaces
-python3.6 -m venv venv
-source venv/bin/activate
-chmod +x main.py
+pip install tabsvsspaces
```
### Usage
@@ -15,3 +13,12 @@ chmod +x main.py
tabsvsspaces folder
tabsvsspaces -e folder
```
+
+
+### Links
+
+ - [Github][github]
+ - [Issues][issues]
+
+[github]: https://github.com/romangraef/tabsvsspaces
+[issues]: https://github.com/romangraef/tabsvsspaces/issues \ No newline at end of file
diff --git a/pkg/ins.sc b/pkg/ins.sc
deleted file mode 100644
index c580d88..0000000
--- a/pkg/ins.sc
+++ /dev/null
@@ -1,31 +0,0 @@
-name tabsvsspaces
-user romangraef
-ver 1.0.0
-
-func install {
- mkdir -p /usr/share/tabsvsspaces
- cp -rf * /usr/share/tabsvsspaces
- ln -fs /usr/share/tabsvsspaces/main.py /usr/bin/tabsvsspaces
-}
-
-func update {
- &install
-}
-
-func install_win {
- &werror
-}
-
-func update_win
-{
- &install_win
-}
-
-func remove_win {
- &werror
-}
-
-func werror {
- @echo "Leider gibt es keinen Windows-Support."
-}
-
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..f810b30
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,34 @@
+import os
+
+from setuptools import setup
+
+
+def read(fname):
+ return open(os.path.join(os.path.dirname(__file__), fname)).read()
+
+
+setup(
+ name='tabsvsspaces',
+ version='1.1.1',
+ author="Roman Gräf",
+ author_email="romangraef@gmail.com",
+ description="A tool for counting spaces vs tabs in a codebase",
+ license="MIT",
+ keywords="tabs spaces linecount counting commandline",
+ packages=['tabsvsspaces'],
+ long_description=read('README.md'),
+ long_description_content_type="text/markdown",
+ url="https://github.com/romangraef/tabsvsspaces",
+ classifiers=[
+ 'Development Status :: 5 - Production/Stable',
+ 'Environment :: Console',
+ 'Intended Audience :: Developers',
+ 'Intended Audience :: Religion',
+ 'License :: OSI Approved :: MIT License',
+ 'Programming Language :: Python :: 3.5',
+ 'Typing :: Typed',
+ ],
+ entry_points=dict(
+ console_scripts='tabsvsspaces=tabsvsspaces:main'
+ )
+)
diff --git a/tabsvsspaces/__init__.py b/tabsvsspaces/__init__.py
new file mode 100644
index 0000000..483cd32
--- /dev/null
+++ b/tabsvsspaces/__init__.py
@@ -0,0 +1,4 @@
+from .find_stats import find_stats, find_all_files, find_stats_for_file, IGNORED_FOLDERS
+from .print_stats import print_stats
+from .stats import Statistics
+from ._main import main \ No newline at end of file
diff --git a/tabsvsspaces/__main__.py b/tabsvsspaces/__main__.py
new file mode 100644
index 0000000..c7c70d0
--- /dev/null
+++ b/tabsvsspaces/__main__.py
@@ -0,0 +1,4 @@
+from . import main
+
+if __name__ == '__main__':
+ main()
diff --git a/main.py b/tabsvsspaces/_main.py
index ff8ad95..b9f6389 100755..100644
--- a/main.py
+++ b/tabsvsspaces/_main.py
@@ -1,15 +1,13 @@
-#!/usr/bin/env python3.6
-
import argparse
from pathlib import Path
-from lib.argparse.pathtype import PathType
-from lib.find_stats import find_stats
-from lib.print_stats import print_stats
-from lib.stats import Statistics
+from tabsvsspaces.pathtype import PathType
+from tabsvsspaces.find_stats import find_stats
+from tabsvsspaces.print_stats import print_stats
+from tabsvsspaces.stats import Statistics
-def main():
+def main(args=None):
parser = argparse.ArgumentParser(
prog='tabsvsspaces',
description='Shows statistics about the usage of tabs and spaces in a given folder'
@@ -25,13 +23,9 @@ def main():
dest='verbose',
action='store_true',
help='show debug information')
- ns = parser.parse_args()
+ ns = parser.parse_args(args)
folder: str = ns.folder
extension: bool = ns.extension
verbose: bool = ns.verbose
stats: Statistics = find_stats(Path(folder), verbose=verbose)
print_stats(stats, extension)
-
-
-if __name__ == '__main__':
- main()
diff --git a/lib/argparse/pathtype.py b/tabsvsspaces/pathtype.py
index 39128cc..39128cc 100644
--- a/lib/argparse/pathtype.py
+++ b/tabsvsspaces/pathtype.py
diff --git a/lib/print_stats.py b/tabsvsspaces/print_stats.py
index 9616caa..1963744 100644
--- a/lib/print_stats.py
+++ b/tabsvsspaces/print_stats.py
@@ -1,4 +1,4 @@
-from lib.stats import Statistics
+from tabsvsspaces.stats import Statistics
def print_stats(stats: Statistics, by_extension: bool):
diff --git a/lib/stats.py b/tabsvsspaces/stats.py
index 42e4461..42e4461 100644
--- a/lib/stats.py
+++ b/tabsvsspaces/stats.py