diff options
author | XavierCLL | 2016-05-11 10:11:57 -0500 |
---|---|---|
committer | XavierCLL | 2016-05-11 10:11:57 -0500 |
commit | 94677b47000669c66da9020c719317125c916532 (patch) | |
tree | a2174546255691f762d2e1999925e867661e5035 | |
parent | 4c161e0f595ab2d5d40df7dc28d73ea5def0b446 (diff) | |
download | aur-94677b47000669c66da9020c719317125c916532.tar.gz |
Update charm
-rw-r--r-- | .SRCINFO | 4 | ||||
-rw-r--r-- | PKGBUILD | 2 | ||||
-rwxr-xr-x | charm | 55 |
3 files changed, 31 insertions, 30 deletions
@@ -1,5 +1,5 @@ # Generated by mksrcinfo v8 -# Wed May 11 15:00:20 UTC 2016 +# Wed May 11 15:11:37 UTC 2016 pkgbase = pycharm-professional pkgdesc = Powerful Python and Django IDE. Professional version. pkgver = 2016.1.3 @@ -44,7 +44,7 @@ pkgbase = pycharm-professional sha256sums = c1a74303d9e870918bd8068f761c8251b996694b1b96b3537fbca317679c4958 sha256sums = ad59415f8ac2c623f9c61453caf70bf75b6b14db2f09807e4ea339a2dc740be9 sha256sums = a90a2b645e733627fefe568ae82fc96716772c13b4431760a822c0c64b0596e9 - sha256sums = 0d6c311067aa925e4f73ab41f4955b033dbc00e0a65c940ceb27e6dae5bb7bb0 + sha256sums = f31a41ab02ba39a08aa218b1239ff7a0156e3b7d68c109eb0249ac6d1db32331 pkgname = pycharm-professional @@ -39,7 +39,7 @@ sha256sums=('36d615f795e9fb62c82c7d9d988ee6c529f9c09aac228f9b45fd832a9fb482a8' 'c1a74303d9e870918bd8068f761c8251b996694b1b96b3537fbca317679c4958' 'ad59415f8ac2c623f9c61453caf70bf75b6b14db2f09807e4ea339a2dc740be9' 'a90a2b645e733627fefe568ae82fc96716772c13b4431760a822c0c64b0596e9' - '0d6c311067aa925e4f73ab41f4955b033dbc00e0a65c940ceb27e6dae5bb7bb0') + 'f31a41ab02ba39a08aa218b1239ff7a0156e3b7d68c109eb0249ac6d1db32331') package() { # base @@ -1,16 +1,17 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +import os import socket import struct import sys -import os import time # see com.intellij.idea.SocketLock for the server side of this interface RUN_PATH = u'/opt/pycharm-professional/bin/pycharm.sh' CONFIG_PATH = u'~/.PyCharm2016.1/config' +SYSTEM_PATH = u'~/.PyCharm2016.1/system' args = [] skip_next = False @@ -45,7 +46,7 @@ for i, arg in enumerate(sys.argv[1:]): args.append(os.path.abspath(arg)) -def launch_with_port(port): +def launch_with_port(port, token): found = False s = socket.socket() @@ -67,7 +68,7 @@ def launch_with_port(port): if found: if args: - cmd = "activate " + os.getcwd() + "\0" + "\0".join(args) + cmd = "activate " + token + '\0' + os.getcwd() + "\0" + "\0".join(args) encoded = struct.pack(">h", len(cmd)) + cmd s.send(encoded) time.sleep(0.5) # don't close socket immediately @@ -76,30 +77,30 @@ def launch_with_port(port): return False -port = -1 -try: - f = open(os.path.join(CONFIG_PATH, 'port')) - port = int(f.read()) -except Exception: - type, value, traceback = sys.exc_info() - print('No IDE instance has been found. New one will be started.') - port = -1 +port_path = os.path.join(CONFIG_PATH, 'port') +token_path = os.path.join(SYSTEM_PATH, 'token') +if os.path.exists(port_path) and os.path.exists(token_path): + try: + f = open(port_path) + port = int(f.read()) + f.close() -if port == -1: - # SocketLock actually allows up to 50 ports, but the checking takes too long - for port in range(6942, 6942 + 10): - if launch_with_port(port): - exit() -else: - if launch_with_port(port): - exit() + f = open(token_path) + token = f.read() + f.close() -if sys.platform == "darwin": - # OS X: RUN_PATH is *.app path - if len(args): - args.insert(0, "--args") - os.execvp("open", ["-a", RUN_PATH] + args) + launch_with_port(port, token) + except: + type, value, traceback = sys.exc_info() + print('No IDE instance has been found. New one will be started.') # todo error else: - # unix common - bin_dir, bin_file = os.path.split(RUN_PATH) - os.execv(RUN_PATH, [bin_file] + args) + print('No IDE instance has been found. New one will be started.') + if sys.platform == "darwin": + # OS X: RUN_PATH is *.app path + if len(args): + args.insert(0, "--args") + os.execvp("open", ["-a", RUN_PATH] + args) + else: + # Unix common + bin_dir, bin_file = os.path.split(RUN_PATH) + os.execv(RUN_PATH, [bin_file] + args) |