diff --git a/__pycache__/build.cpython-38.pyc b/__pycache__/build.cpython-38.pyc new file mode 100644 index 0000000..0d9f8c5 Binary files /dev/null and b/__pycache__/build.cpython-38.pyc differ diff --git a/__pycache__/editor.cpython-38.pyc b/__pycache__/editor.cpython-38.pyc new file mode 100644 index 0000000..0144667 Binary files /dev/null and b/__pycache__/editor.cpython-38.pyc differ diff --git a/build.py b/build.py new file mode 100644 index 0000000..16aa91f --- /dev/null +++ b/build.py @@ -0,0 +1,10 @@ +def build(): + import os + import editor as ed + os.system("pip install --upgrade pip build twine") + os.system("clear") + ed.edit() + os.system("clear") + print("Run these commands next: \n cd package\n python3 -m build\n python3 -m twine upload -r pypi dist/*") +# __token__ + os.system("bash") \ No newline at end of file diff --git a/editor.py b/editor.py new file mode 100644 index 0000000..7cc5c77 --- /dev/null +++ b/editor.py @@ -0,0 +1,22 @@ +def edit(): +# Edit setup.cfg + my_file = open("package/setup.cfg") + string_list = my_file.readlines() + my_file.close() + ver = input("Version: ") + update = input("What's new?: ") + string_list[2] = f"version = {ver}\n" + my_file = open("package/setup.cfg", "w") + new_file_contents = "".join(string_list) + my_file.write(new_file_contents) + my_file.close() +# Edit README.md + my_file = open("package/README.md") + string_list = my_file.readlines() + my_file.close() + string_list[9] = f"###### v.{ver}:\n" + string_list[10] = f"{update}\n" + my_file = open("package/README.md", "w") + new_file_contents = "".join(string_list) + my_file.write(new_file_contents) + my_file.close() \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..de2240d --- /dev/null +++ b/main.py @@ -0,0 +1,2 @@ +#from build import build +#build() \ No newline at end of file diff --git a/package/README.md b/package/README.md index 14b0660..2d0e8f5 100644 --- a/package/README.md +++ b/package/README.md @@ -2,4 +2,10 @@ This is a simple and easy to use package that allows you to capture individual keystrokes from the user. #### Forms: 1. (Default) Recive key as a string -2. Recive key as bytes \ No newline at end of file +2. Recive key as bytes +#### How to Use: +1. from fkeycapture import get +2. Use it like this +: get([number of keys to capture],[if you want bytes output, make this 'True']) +###### v.1.0.6: +Finally made the package usable. diff --git a/package/dist/fkeycapture-1.0.6-py3-none-any.whl b/package/dist/fkeycapture-1.0.6-py3-none-any.whl new file mode 100644 index 0000000..fd569f4 Binary files /dev/null and b/package/dist/fkeycapture-1.0.6-py3-none-any.whl differ diff --git a/package/dist/fkeycapture-1.0.6.tar.gz b/package/dist/fkeycapture-1.0.6.tar.gz new file mode 100644 index 0000000..ee3296f Binary files /dev/null and b/package/dist/fkeycapture-1.0.6.tar.gz differ diff --git a/package/dist/fkeycapture-Firepup650-0.0.2.tar.gz b/package/dist/fkeycapture-Firepup650-0.0.2.tar.gz deleted file mode 100644 index 0dc0c1a..0000000 Binary files a/package/dist/fkeycapture-Firepup650-0.0.2.tar.gz and /dev/null differ diff --git a/package/dist/fkeycapture_Firepup650-0.0.2-py3-none-any.whl b/package/dist/fkeycapture_Firepup650-0.0.2-py3-none-any.whl deleted file mode 100644 index c6e5ded..0000000 Binary files a/package/dist/fkeycapture_Firepup650-0.0.2-py3-none-any.whl and /dev/null differ diff --git a/package/setup.cfg b/package/setup.cfg index 58c3c68..059a9d5 100644 --- a/package/setup.cfg +++ b/package/setup.cfg @@ -1,6 +1,6 @@ [metadata] -name = fkeycapture-Firepup650 -version = 0.0.2 +name = fkeycapture +version = 1.0.6 author = Firepup650 author_email = firepyp650@gmail.com description = A way to capture keystrokes @@ -14,7 +14,7 @@ classifiers = Programming Language :: Python :: 3 License :: OSI Approved :: MIT License Operating System :: OS Independent - Development Status :: 4 - Beta + Development Status :: 5 - Production/Stable Environment :: Console Intended Audience :: Developers Natural Language :: English diff --git a/package/src/fkeycapture_Firepup650.egg-info/PKG-INFO b/package/src/fkeycapture.egg-info/PKG-INFO similarity index 72% rename from package/src/fkeycapture_Firepup650.egg-info/PKG-INFO rename to package/src/fkeycapture.egg-info/PKG-INFO index d142f63..8c06f47 100644 --- a/package/src/fkeycapture_Firepup650.egg-info/PKG-INFO +++ b/package/src/fkeycapture.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 -Name: fkeycapture-Firepup650 -Version: 0.0.2 +Name: fkeycapture +Version: 1.0.6 Summary: A way to capture keystrokes Home-page: https://github.com/Alexander-Maples/fkeycapture Author: Firepup650 @@ -13,11 +13,18 @@ Description: # fkeycapture #### Forms: 1. (Default) Recive key as a string 2. Recive key as bytes + #### How to Use: + 1. from fkeycapture import get + 2. Use it like this + : get([number of keys to capture],[if you want bytes output, make this 'True']) + ###### v.1.0.6: + Finally made the package usable. + Platform: UNKNOWN Classifier: Programming Language :: Python :: 3 Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent -Classifier: Development Status :: 4 - Beta +Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Console Classifier: Intended Audience :: Developers Classifier: Natural Language :: English diff --git a/package/src/fkeycapture.egg-info/SOURCES.txt b/package/src/fkeycapture.egg-info/SOURCES.txt new file mode 100644 index 0000000..e2dbd60 --- /dev/null +++ b/package/src/fkeycapture.egg-info/SOURCES.txt @@ -0,0 +1,9 @@ +LICENSE +README.md +pyproject.toml +setup.cfg +src/fkeycapture/__init__.py +src/fkeycapture.egg-info/PKG-INFO +src/fkeycapture.egg-info/SOURCES.txt +src/fkeycapture.egg-info/dependency_links.txt +src/fkeycapture.egg-info/top_level.txt \ No newline at end of file diff --git a/package/src/fkeycapture_Firepup650.egg-info/dependency_links.txt b/package/src/fkeycapture.egg-info/dependency_links.txt similarity index 100% rename from package/src/fkeycapture_Firepup650.egg-info/dependency_links.txt rename to package/src/fkeycapture.egg-info/dependency_links.txt diff --git a/package/src/fkeycapture_Firepup650.egg-info/top_level.txt b/package/src/fkeycapture.egg-info/top_level.txt similarity index 100% rename from package/src/fkeycapture_Firepup650.egg-info/top_level.txt rename to package/src/fkeycapture.egg-info/top_level.txt diff --git a/package/src/fkeycapture/__init__.py b/package/src/fkeycapture/__init__.py index e69de29..106e83c 100644 --- a/package/src/fkeycapture/__init__.py +++ b/package/src/fkeycapture/__init__.py @@ -0,0 +1,38 @@ +import termios, fcntl, sys +global fd,flags_save,attrs_save +fd = sys.stdin.fileno() +flags_save = fcntl.fcntl(fd, fcntl.F_GETFL) +attrs_save = termios.tcgetattr(fd) +def getp1(): + import termios, fcntl, sys, os + fd = sys.stdin.fileno() + # save old state + flags_save = fcntl.fcntl(fd, fcntl.F_GETFL) + attrs_save = termios.tcgetattr(fd) + # make raw - the way to do this comes from the termios(3) man page. + attrs = list(attrs_save) # copy the stored version to update + # iflag + attrs[0] &= ~(termios.IGNBRK | termios.BRKINT | termios.PARMRK + | termios.ISTRIP | termios.INLCR | termios. IGNCR + | termios.ICRNL | termios.IXON ) + # oflag + attrs[1] &= ~termios.OPOST + # cflag + attrs[2] &= ~(termios.CSIZE | termios. PARENB) + attrs[2] |= termios.CS8 + # lflag + attrs[3] &= ~(termios.ECHONL | termios.ECHO | termios.ICANON + | termios.ISIG | termios.IEXTEN) + termios.tcsetattr(fd, termios.TCSANOW, attrs) + # turn off non-blocking + fcntl.fcntl(fd, fcntl.F_SETFL, flags_save & ~os.O_NONBLOCK) +def getp2(): + termios.tcsetattr(fd, termios.TCSAFLUSH, attrs_save) + fcntl.fcntl(fd, fcntl.F_SETFL, flags_save) +def get(keycount=1,bytes=False): + getp1() + key = sys.stdin.read(keycount) + getp2() + if bytes == True: + key = key.encode() + return key \ No newline at end of file diff --git a/package/src/fkeycapture/fkeycapture.py b/package/src/fkeycapture/fkeycapture.py deleted file mode 100644 index 106e83c..0000000 --- a/package/src/fkeycapture/fkeycapture.py +++ /dev/null @@ -1,38 +0,0 @@ -import termios, fcntl, sys -global fd,flags_save,attrs_save -fd = sys.stdin.fileno() -flags_save = fcntl.fcntl(fd, fcntl.F_GETFL) -attrs_save = termios.tcgetattr(fd) -def getp1(): - import termios, fcntl, sys, os - fd = sys.stdin.fileno() - # save old state - flags_save = fcntl.fcntl(fd, fcntl.F_GETFL) - attrs_save = termios.tcgetattr(fd) - # make raw - the way to do this comes from the termios(3) man page. - attrs = list(attrs_save) # copy the stored version to update - # iflag - attrs[0] &= ~(termios.IGNBRK | termios.BRKINT | termios.PARMRK - | termios.ISTRIP | termios.INLCR | termios. IGNCR - | termios.ICRNL | termios.IXON ) - # oflag - attrs[1] &= ~termios.OPOST - # cflag - attrs[2] &= ~(termios.CSIZE | termios. PARENB) - attrs[2] |= termios.CS8 - # lflag - attrs[3] &= ~(termios.ECHONL | termios.ECHO | termios.ICANON - | termios.ISIG | termios.IEXTEN) - termios.tcsetattr(fd, termios.TCSANOW, attrs) - # turn off non-blocking - fcntl.fcntl(fd, fcntl.F_SETFL, flags_save & ~os.O_NONBLOCK) -def getp2(): - termios.tcsetattr(fd, termios.TCSAFLUSH, attrs_save) - fcntl.fcntl(fd, fcntl.F_SETFL, flags_save) -def get(keycount=1,bytes=False): - getp1() - key = sys.stdin.read(keycount) - getp2() - if bytes == True: - key = key.encode() - return key \ No newline at end of file diff --git a/package/src/fkeycapture_Firepup650.egg-info/SOURCES.txt b/package/src/fkeycapture_Firepup650.egg-info/SOURCES.txt deleted file mode 100644 index 08bb027..0000000 --- a/package/src/fkeycapture_Firepup650.egg-info/SOURCES.txt +++ /dev/null @@ -1,10 +0,0 @@ -LICENSE -README.md -pyproject.toml -setup.cfg -src/fkeycapture/__init__.py -src/fkeycapture/fkeycapture.py -src/fkeycapture_Firepup650.egg-info/PKG-INFO -src/fkeycapture_Firepup650.egg-info/SOURCES.txt -src/fkeycapture_Firepup650.egg-info/dependency_links.txt -src/fkeycapture_Firepup650.egg-info/top_level.txt \ No newline at end of file