Finally made the package usable.
This commit is contained in:
Firepup Sixfifty 2021-11-21 22:19:25 +00:00
parent 2a7410eb50
commit 65cbb2d5e3
18 changed files with 101 additions and 55 deletions

Binary file not shown.

Binary file not shown.

10
build.py Normal file
View file

@ -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")

22
editor.py Normal file
View file

@ -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()

2
main.py Normal file
View file

@ -0,0 +1,2 @@
#from build import build
#build()

View file

@ -3,3 +3,9 @@ This is a simple and easy to use package that allows you to capture individual k
#### 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.

Binary file not shown.

BIN
package/dist/fkeycapture-1.0.6.tar.gz vendored Normal file

Binary file not shown.

Binary file not shown.

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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