Adds setup.py
This commit is contained in:
parent
8ae7793337
commit
9c935cb22e
40
chalk
40
chalk
|
@ -9,15 +9,21 @@
|
|||
# https://www.floodgap.com/software/ffsl/license.txt
|
||||
#_
|
||||
|
||||
|
||||
### Notes . . . .
|
||||
# \001 and \002 fix a readline issue
|
||||
# See: https://stackoverflow.com/questions/9468435/how-to-fix-column-calculation-in-python-readline-if-using-color-prompt
|
||||
##################
|
||||
|
||||
###########################################################
|
||||
# Imports
|
||||
###########################################################
|
||||
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
import re
|
||||
import readline
|
||||
import tempfile
|
||||
|
||||
###########################################################
|
||||
# Globals
|
||||
|
@ -29,7 +35,7 @@ file_changed = False
|
|||
filepath = ''
|
||||
filename = 'scratch buffer'
|
||||
view_loc = {'last': 0, 'count': 0}
|
||||
version = 2.1
|
||||
__VERSION__ = '2.1.0'
|
||||
|
||||
|
||||
###########################################################
|
||||
|
@ -37,8 +43,6 @@ version = 2.1
|
|||
###########################################################
|
||||
|
||||
class c:
|
||||
# \001 and \002 fix a readline issue
|
||||
# See: https://stackoverflow.com/questions/9468435/how-to-fix-column-calculation-in-python-readline-if-using-color-prompt
|
||||
black = ''
|
||||
red = '\033[0;31m'
|
||||
b_red = '\033[1;31m'
|
||||
|
@ -121,6 +125,8 @@ def print_help():
|
|||
" {}.a{} - Save as a new file (will request file location)".format(c.b_green, c.end),
|
||||
" {}. {} - Finish writing/exit (will prompt for save)".format(c.b_green, c.end),
|
||||
"",
|
||||
" {}.r{} - Print the document to the default printer".format(c.b_green, c.end),
|
||||
"",
|
||||
"{}- - -{}".format(c.yellow, c.end),
|
||||
""
|
||||
]
|
||||
|
@ -161,7 +167,7 @@ def print_file_info():
|
|||
|
||||
# Print banner will print the program name,
|
||||
def print_banner():
|
||||
print('\n Chalk {} by sloum\n'.format(version))
|
||||
print('\n Chalk {} by sloum\n'.format(__VERSION__))
|
||||
print_file_info()
|
||||
print(" For a command list, enter {}.?\n{}".format(c.green, c.end))
|
||||
|
||||
|
@ -278,6 +284,8 @@ def command_router(ln):
|
|||
cut_lines()
|
||||
elif ln == '.s':
|
||||
save_changes()
|
||||
elif ln == '.r':
|
||||
print_document()
|
||||
else:
|
||||
print('{:9}{}Unknown command: {}{}'.format(' ', c.red, ln, c.end))
|
||||
|
||||
|
@ -557,13 +565,17 @@ def view_paste_buffer():
|
|||
print('')
|
||||
|
||||
|
||||
def print_document():
|
||||
with tempfile.NamedTemporaryFile(mode = 'w+') as f:
|
||||
if sys.platform == 'win32':
|
||||
f.write('\r\n'.join(content))
|
||||
os.startfile(f.name, 'print')
|
||||
else:
|
||||
f.write('\n'.join(content))
|
||||
os.system('lpr {}'.format(f.name))
|
||||
|
||||
|
||||
###########################################################
|
||||
# Init
|
||||
###########################################################
|
||||
|
||||
if __name__ == '__main__':
|
||||
def main():
|
||||
args = sys.argv
|
||||
if len(args) > 2:
|
||||
print('Incorrect number of arguments:')
|
||||
|
@ -583,3 +595,11 @@ if __name__ == '__main__':
|
|||
# Run the editor
|
||||
chalk(filepath)
|
||||
|
||||
|
||||
|
||||
###########################################################
|
||||
# Init
|
||||
###########################################################
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
from setuptools import setup
|
||||
|
||||
with open("README.md", "r") as fh:
|
||||
long_description = fh.read()
|
||||
|
||||
setup(
|
||||
name='chalk',
|
||||
version='2.1.0',
|
||||
description="Line based text editor",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
author='sloum',
|
||||
author_email='sloum@rawtext.club',
|
||||
url='https://tildegit.org/sloum/chalk',
|
||||
classifiers=[
|
||||
'License :: Other/Proprietary License',
|
||||
'Programming Language :: Python :: 3 :: Only',
|
||||
'Topic :: Text Editors',
|
||||
'Intended Audience :: End Users/Desktop',
|
||||
'Environment :: Console',
|
||||
'Operating System :: POSIX',
|
||||
'Development Status :: 5 - Production/Stable',
|
||||
],
|
||||
py_modules = ['chalk'],
|
||||
entry_points={
|
||||
"console_scripts": ["chalk=chalk:main"]
|
||||
},
|
||||
python_requires='>=3',
|
||||
install_requires=[],
|
||||
)
|
Loading…
Reference in New Issue