Changeset - aeafe7d0b033
[Not reviewed]
default
0 2 1
drewp@bigasterisk.com - 3 years ago 2022-04-07 08:07:54
drewp@bigasterisk.com
have bin/* run via pdm's python config
3 files changed with 5 insertions and 39 deletions:
0 comments (0 inline, 0 general)
bin/python
Show inline comments
 
new file 100755
 
#!/bin/sh
 
pdm run python3 "$@"
bin/run_local.py
Show inline comments
 
# allows bin/* to work without installation
 

	
 
# this should be turned off when the programs are installed
 

	
 
import sys, os, socket
 

	
 
from twisted.python.failure import Failure
 

	
 
def fixSysPath():
 
    root = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]),
 
                                        '..')) + '/'
 
    sys.path = [
 
        root,
 
        root + 'env/lib/python3.7',
 
        root + 'env/lib/python3.7/plat-x86_64-linux-gnu',
 
        root + 'env/lib/python3.7/lib-tk',
 
        root + 'env/lib/python3.7/lib-old',
 
        root + 'env/lib/python3.7/lib-dynload',
 
        '/usr/lib/python3/dist-packages/',
 
        '/usr/lib/python3.7',
 
        #        '/usr/lib/python3.7/plat-x86_64-linux-gnu',
 
        #        '/usr/lib/python3.7/lib-tk',
 
        #        root + 'env/local/lib/python3.7/site-packages',
 
        #        root + 'env/local/lib/python3.7/site-packages/gtk-2.0',
 
        root + 'env/lib/python3.7/site-packages',
 
        #        root + 'env/lib/python3.7/site-packages/gtk-2.0',
 
    ]
 

	
 

	
 
fixSysPath()
 

	
 
from twisted.python.failure import Failure
 
# to support 'import light9' until I rearrange things better:
 
sys.path.append('.')
 

	
 
try:
 
    import tkinter
 
except ImportError:
 
    pass
 
else:
 

	
 
    def rce(self, exc, val, tb):
 
        sys.stderr.write("Exception in Tkinter callback\n")
 
        if True:
 
            sys.excepthook(exc, val, tb)
 
        else:
 
            Failure(val, exc, tb).printDetailedTraceback()
 

	
 
    tkinter.Tk.report_callback_exception = rce
 

	
 
import coloredlogs, logging, time
 
try:
 
    import faulthandler
 
    faulthandler.enable()
 
except ImportError:
 
    pass
 

	
 
if 0:
 
    from IPython.core import ultratb
 
    sys.excepthook = ultratb.FormattedTB(mode='Verbose',
 
                                         color_scheme='Linux',
 
                                         call_pdb=1)
 

	
 
progName = sys.argv[0].split('/')[-1]
 
log = logging.getLogger()  # this has to get the root logger
 
log.name = progName  # but we can rename it for clarity
 

	
 

	
 
class FractionTimeFilter(logging.Filter):
 

	
 
    def filter(self, record):
 
        record.fractionTime = (
 
            time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(record.created)) +
 
            ("%.3f" % (record.created % 1)).lstrip('0'))
 
        # Don't filter the record.
 
        return 1
 

	
 

	
 
coloredlogs.install(
 
    level='DEBUG',
 
    fmt='%(fractionTime)s %(name)s[%(process)d] %(levelname)s %(message)s')
 
logging.getLogger().handlers[0].addFilter(FractionTimeFilter())
makefile
Show inline comments
 
### setup ###
 

	
 
packages:
 
	sudo aptitude install coffeescript normalize-audio audacity python3-pygame libffi-dev tix libzmq3-dev python3-dev libssl-dev python3-opencv python3-cairo npm git virtualenv python3-virtualenv nginx-full python3-tk zlib1g-dev libjpeg8-dev curl
 

	
 
# also pip3 install -U invoke (don't use ubuntu's version)
 

	
 
gst_packages:
 
	sudo aptitude install python3-gi gir1.2-gst-plugins-base-1.0 libgirepository-1.0-1 gir1.2-gstreamer-1.0 gstreamer1.0-tools gstreamer1.0-plugins-good gstreamer1.0-pulseaudio python3-gst-1.0 gir1.2-goocanvas-2.0
 

	
 
PYTHON=/usr/bin/python3
 

	
 
create_virtualenv:
 
	mkdir -p env
 
	virtualenv -p $(PYTHON) env
 
	env/bin/pip install -U pip
 
	ln -sf ../env/bin/python bin/python
 

	
 
install_python_deps:
 
	env/bin/pip install --index-url https://projects.bigasterisk.com/ --extra-index-url https://pypi.org/simple -U -r requirements.txt
 

	
 
binexec:
 
	chmod a+x bin/*
 

	
 

	
 
node_modules/bower/bin/bower:
 
	npm install
 

	
 
bin/node:
 
	ln -sf `which nodejs` bin/node
 

	
 
bower: node_modules/bower/bin/bower bin/node
 
	cd light9/web/lib; nodejs ../../../node_modules/bower/bin/bower install
 

	
 
npm_install:
 
	npm install
 

	
 
node_modules/n3/n3-browser.js:
 
	(cd node_modules/n3; nodejs ../browserify/bin/cmd.js --standalone N3 --require n3 -o n3-browser.js)
 

	
 
light9/web/lib/debug/debug-build.js:
 
	node_modules/browserify/bin/cmd.js light9/web/lib/debug/src/browser.js -o light9/web/lib/debug/debug-build.js --standalone debug
 

	
 
light9/web/lib/debug/debug-build-es6.js:
 
	node_modules/browserify/bin/cmd.js light9/web/lib/debug/src/browser.js -o light9/web/lib/debug/debug-build-es6.js --standalone debug
 
	echo "\nexport default window.debug;" >> light9/web/lib/debug/debug-build-es6.js
 

	
 
lit_fix:
 
	perl -pi -e "s,'lit-html,'/node_modules/lit-html,; s,lit-html',lit-html/lit-html.js'," node_modules/lit-element/lit-element.js
 

	
 
round_fix:
 
	perl -pi -e 's/module.exports = rounding/export { rounding }/' node_modules/significant-rounding/index.js
 

	
 
light9/web/lib/underscore/underscore-min-es6.js:
 
	cp light9/web/lib/underscore/underscore-min.js light9/web/lib/underscore/underscore-min-es6.js
 
	perl -pi -e 's/call\(this\);/call(window); export default window._;/' light9/web/lib/underscore/underscore-min-es6.js
 

	
 
npm: npm_install node_modules/n3/n3-browser.js light9/web/lib/debug/debug-build.js light9/web/lib/debug/debug-build-es6.js lit_fix round_fix light9/web/lib/underscore/underscore-min-es6.js
 

	
 

	
 
bin/ascoltami2: gst_packages link_to_sys_packages
 

	
 
effect_node_setup: create_virtualenv packages binexec install_python_deps
 

	
 
tkdnd_build:
 
	# get tkdnd r95 with subversion
 
	# then apply tkdnd-patch-on-r95 to that
 
	cd tkdnd/trunk
 
	./configure
 
	make
 

	
 
### build ###
 

	
0 comments (0 inline, 0 general)