Skip to content

Instantly share code, notes, and snippets.

@IBestuzhev
Last active February 13, 2019 05:01
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save IBestuzhev/d022446f71267591be76fb48152175b7 to your computer and use it in GitHub Desktop.
Save IBestuzhev/d022446f71267591be76fb48152175b7 to your computer and use it in GitHub Desktop.
Pylint for remote projects
#!/usr/bin/env python3
import subprocess
import sys
path = sys.argv[-1]
if path.startswith('/path/to/my/local/source/folder/'):
path = path.replace('/path/to/my/local/source/folder/', '/app/folder/')
subprocess.run(['docker-compose', 'exec', '-T', 'cross', 'sh', '-c',
"PYTHONPATH=/app/folder/extrasrc pylint {} {}".format(" ".join(sys.argv[1:-1]), path)],
stdout=sys.stdout)
else:
subprocess.run(['/home/igor/.local/bin/pylint'] + sys.argv[1:])
import io
import sys
import traceback
import subprocess
_input = io.open(sys.stdin.fileno(), encoding='utf-8')
while True:
try:
data = _input.readline().strip()
if not data:
continue
proc = subprocess.Popen(
['docker-compose', 'run', '--rm', '--entrypoint=python', 'cross', 'jd/completion.py', 'release'],
stdout=sys.stdout,
stdin=subprocess.PIPE,
cwd='/path/to/my/local/source/'
)
proc.communicate(input=(data + '\n').encode('utf-8'))
except Exception:
sys.stderr.write(traceback.format_exc() + '\n')
sys.stderr.flush()
sys.exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment