voussoirkit
This commit is contained in:
Ethan Dalool 2016-10-31 19:44:55 -07:00
parent 1e8786be61
commit f5c47d0f42
9 changed files with 148 additions and 19 deletions

View file

@ -4,7 +4,14 @@ from Crypto.Cipher import AES
import sys
import os
sys.path.append('C:\\git\\else\\Bytestring'); import bytestring
try:
sys.path.append('C:\\git\\else\\Bytestring')
import bytestring
except ImportError:
# pip install
# https://raw.githubusercontent.com/voussoir/else/master/_voussoirkit/voussoirkit.zip
from voussoirkit import bytestring
BLOCK_SIZE = 32

View file

@ -7,9 +7,19 @@ import time
import urllib
import warnings
sys.path.append('C:\\git\\else\\bytestring'); import bytestring
sys.path.append('C:\\git\\else\\clipext'); import clipext
sys.path.append('C:\\git\\else\\ratelimiter'); import ratelimiter
try:
sys.path.append('C:\\git\\else\\Bytestring')
sys.path.append('C:\\git\\else\\clipext');
sys.path.append('C:\\git\\else\\ratelimiter');
import bytestring
import ratelimiter
import clipext
except ImportError:
# pip install
# https://raw.githubusercontent.com/voussoir/else/master/_voussoirkit/voussoirkit.zip
from vousoirkit import bytestring
from vousoirkit import ratelimiter
from vousoirkit import clipext
warnings.simplefilter('ignore')

View file

@ -6,8 +6,16 @@ import os
import requests
import sys
sys.path.append('C:\\git\\else\\clipext'); import clipext
sys.path.append('C:\\git\\else\\downloady'); import downloady
try:
sys.path.append('C:\\git\\else\\Clipext');
sys.path.append('C:\\git\\else\\Downloady');
import clipext
import downloady
except ImportError:
# pip install
# https://raw.githubusercontent.com/voussoir/else/master/_voussoirkit/voussoirkit.zip
from voussoirkit import clipext
from voussoirkit import downloady
''' '''

View file

@ -123,11 +123,16 @@ import sys
## import tkinter
import urllib.parse
# Please consult my github repo for these files
# https://github.com/voussoir/else
sys.path.append('C:\\git\\else\\Downloady'); import downloady
sys.path.append('C:\\git\\else\\Bytestring'); import bytestring
try:
sys.path.append('C:\\git\\else\\Bytestring');
sys.path.append('C:\\git\\else\\Downloady');
import bytestring
import downloady
except ImportError:
# pip install
# https://raw.githubusercontent.com/voussoir/else/master/_voussoirkit/voussoirkit.zip
from voussoirkit import bytestring
from voussoirkit import downloady
DOWNLOAD_CHUNK = 16 * bytestring.KIBIBYTE
FILENAME_BADCHARS = '/\\:*?"<>|'

View file

@ -8,9 +8,19 @@ import socketserver
import sys
import types
sys.path.append('C:\\git\\else\\Bytestring'); import bytestring
sys.path.append('C:\\git\\else\\Pathclass'); import pathclass
sys.path.append('C:\\git\\else\\Ratelimiter'); import ratelimiter
try:
sys.path.append('C:\\git\\else\\Bytestring');
sys.path.append('C:\\git\\else\\Pathclass');
sys.path.append('C:\\git\\else\\Ratelimiter');
import bytestring
import pathclass
import ratelimiter
except ImportError:
# pip install
# https://raw.githubusercontent.com/voussoir/else/master/_voussoirkit/voussoirkit.zip
from voussoirkit import bytestring
from voussoirkit import pathclass
from voussoirkit import ratelimiter
FILE_READ_CHUNK = bytestring.MIBIBYTE
RATELIMITER = ratelimiter.Ratelimiter(16 * bytestring.MIBIBYTE)

View file

@ -10,9 +10,19 @@ import string
import sys
import time
sys.path.append('C:\\git\\else\\Bytestring'); import bytestring
sys.path.append('C:\\git\\else\\Pathclass'); import pathclass
sys.path.append('C:\\git\\else\\Ratelimiter'); import ratelimiter
try:
sys.path.append('C:\\git\\else\\Bytestring');
sys.path.append('C:\\git\\else\\Pathclass');
sys.path.append('C:\\git\\else\\Ratelimiter');
import bytestring
import pathclass
import ratelimiter
except ImportError:
# pip install
# https://raw.githubusercontent.com/voussoir/else/master/_voussoirkit/voussoirkit.zip
from voussoirkit import bytestring
from voussoirkit import pathclass
from voussoirkit import ratelimiter
logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger(__name__)

View file

@ -3,8 +3,16 @@ import sys
import threading
import time
sys.path.append('C:\\git\\else\\clipext'); import clipext
sys.path.append('C:\\git\\else\\downloady'); import downloady
try:
sys.path.append('C:\\git\\else\\Clipext');
sys.path.append('C:\\git\\else\\Downloady');
import clipext
import downloady
except ImportError:
# pip install
# https://raw.githubusercontent.com/voussoir/else/master/_voussoirkit/voussoirkit.zip
from voussoirkit import bytestring
from voussoirkit import pathclass
def remove_finished(threads):
threads = [t for t in threads if t.is_alive()]

View file

@ -0,0 +1,71 @@
import glob
import shutil
import os
PACKAGE = 'voussoirkit'
PATHS = [
'C:\\git\\else\\Bytestring\\bytestring.py',
'C:\\git\\else\\Clipext\\clipext.py',
'C:\\git\\else\\Downloady\\downloady.py',
'C:\\git\\else\\Pathclass\\pathclass.py',
'C:\\git\\else\\Ratelimiter\\ratelimiter.py',
'C:\\git\\else\\RateMeter\\ratemeter.py',
'C:\\git\\else\\SpinalTap\\spinal.py',
]
os.makedirs(PACKAGE, exist_ok=True)
for zipfile in glob.glob('*.zip'):
os.remove(zipfile)
py_modules = []
local_paths = []
for path in PATHS:
basename = os.path.basename(path)
module_name = '{package}.{module}'.format(package=PACKAGE, module=basename.replace('.py', ''))
py_modules.append(module_name)
local_path = os.path.join(PACKAGE, basename)
local_paths.append(local_path)
try:
os.link(path, local_path)
except FileExistsError:
pass
print('Creating setup.py')
setup_content = '''
import setuptools
setuptools.setup(
author='voussoir',
name='{package}',
version='0.0.1',
description='',
py_modules=[{py_modules}],
)
'''
py_modules = ["'%s'" % x for x in py_modules]
py_modules = ', '.join(py_modules)
setup_content = setup_content.format(package=PACKAGE, py_modules=py_modules)
setup_file = open('setup.py', 'w')
setup_file.write(setup_content)
setup_file.close()
print('Executing setup.py')
os.system('python setup.py sdist')
print('Moving zip file')
zips = glob.glob('dist\\*.zip')
for zip_filename in zips:
new_zip = os.path.basename(zip_filename)
new_zip = os.path.abspath(new_zip)
shutil.move(zip_filename, new_zip)
print('Deleting temp')
shutil.rmtree('dist')
shutil.rmtree(PACKAGE)
shutil.rmtree(glob.glob('*.egg-info')[0])
os.remove('setup.py')
os.rename(glob.glob('*.zip')[0], 'voussoirkit.zip')

Binary file not shown.