Last active
February 13, 2019 05:01
-
-
Save IBestuzhev/d022446f71267591be76fb48152175b7 to your computer and use it in GitHub Desktop.
Pylint for remote projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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:]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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