working TSV and SWP and modules

This commit is contained in:
Q
2021-10-30 10:10:14 +03:00
parent e2c4b2c147
commit ecd8a10c5d
8 changed files with 83 additions and 18 deletions

View File

@@ -1 +1 @@
../web/SimpleWebPage.py ../py-packages/SimpleWebPage/simplewebpage/__init__.py

25
py-packages/Makefile Normal file
View File

@@ -0,0 +1,25 @@
.PHONY: help
help: ## *:・゚✧*:・゚✧ This help *:・゚✧*:・゚✧
@printf "\033[36;1m %14s \033[0;32;1m %s\033[0m\n" Target Description
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk ' \
BEGIN {FS = ":.*?## "}; \
{ if ( $$1 != "-") { \
printf "\033[31;1;40m[ \033[36;1;40m%14s \033[31;1;40m]\033[0;32;1m %s\033[0m\n", $$1, $$2 \
} else { \
printf " \033[0;33;1m=^= %-25s =^=\033[0m\n", $$2 \
} \
} \
'
clean: ## Clean build and .egg folder in py modules
rm -vr */build/ */*.egg-info
pipx: ## Install all packages with pipx
for module in *; do if [[ -f $module/setup.py ]]; then pipx install $module; fi; done
foo:
pass

View File

@@ -0,0 +1,25 @@
from distutils.core import setup
def version_reader(path):
for line in open(path,"rt").read(1024).split("\n"):
if line.startswith("VERSION"):
return line.split("=")[1].strip().replace('"',"")
version = version_reader(os.path.join("simplewebpage","__init__.py"))
setup(
name="SimpleWebPage",
packages=["simplewebpage"],
version=version,
description="HTML file index generator.",
author="Ville Rantanen",
author_email="ville.q.rantanen@gmail.com",
keywords=["HTML", "generator"],
entry_points={
"console_scripts": [
"SimpleWebPage=simplewebpage:main",
],
},
install_requires = [
'markdown>=3.3.4'
]
)

View File

@@ -1006,7 +1006,9 @@ def sizeof(num):
return "%3.1f %s" % (num, x) return "%3.1f %s" % (num, x)
num /= 1024.0 num /= 1024.0
def main():
if __name__ == "__main__":
opts = setup() opts = setup()
generate_index(opts) generate_index(opts)
if __name__ == "__main__":
main()

View File

@@ -4,6 +4,8 @@ import os
import re import re
from argparse import ArgumentParser from argparse import ArgumentParser
__version__ = "1.0"
class TSVFilter: class TSVFilter:
def __init__(self): def __init__(self):
@@ -16,6 +18,8 @@ class TSVFilter:
def get_options(self): def get_options(self):
parser = ArgumentParser() parser = ArgumentParser()
# ~ parser.add_argument('--version', action='version', version=open(os.path.join(os.path.dirname(__file__),"VERSION"), "rt").read())
parser.add_argument("--version", action="version", version=__version__)
parser.add_argument( parser.add_argument(
"-f", "-f",
action="store", action="store",

View File

@@ -0,0 +1,24 @@
from distutils.core import setup
def version_reader(path):
for line in open(path, "rt").read(1024).split("\n"):
if line.startswith("__version__"):
return line.split("=")[1].strip().replace('"', "")
version = version_reader(os.path.join("TSVFilter", "filter.py"))
setup(
name="TSVFilter",
packages=["TSVFilter"],
version=version,
description="TSV column filter.",
author="Ville Rantanen",
author_email="ville.q.rantanen@gmail.com",
keywords=["TSV", "data"],
entry_points={
"console_scripts": [
"TSVFilter=TSVFilter:main",
],
},
)

View File

@@ -1,15 +0,0 @@
from distutils.core import setup
setup(
name = 'TSVFilter',
packages = ['TSVFilter'],
version = '1.0',
description = 'TSV column filter.',
author = 'Ville Rantanen',
author_email = 'ville.q.rantanen@gmail.com',
keywords = ['TSV', 'data'],
entry_points = {
"console_scripts": [
"TSVFilter=TSVFilter:main",
],
},
)