diff --git a/.SRCINFO b/.SRCINFO index f395bd8..fb770db 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,6 +1,6 @@ pkgbase = pycharm-professional pkgdesc = Powerful Python and Django IDE. Professional Edition. - pkgver = 2019.1.3 + pkgver = 2019.2.0 pkgrel = 1 url = https://www.jetbrains.com/pycharm/ arch = x86_64 @@ -38,16 +38,16 @@ pkgbase = pycharm-professional backup = opt/pycharm-professional/bin/pycharm.vmoptions backup = opt/pycharm-professional/bin/pycharm64.vmoptions backup = opt/pycharm-professional/bin/idea.properties - source = https://download.jetbrains.com/python/pycharm-professional-2019.1.3.tar.gz + source = https://download.jetbrains.com/python/pycharm-professional-2019.2.tar.gz source = pycharm-professional.desktop source = pycharm source = charm.desktop source = charm - sha256sums = 8322de8b816895fcb7fd854e83d25084b0593ea2b90b5b4598a495ef2e958824 + sha256sums = 1940fce9f162b8a804672379345d6b4ec343d2ec65b3d3054bd088e8b1fdfbb4 sha256sums = aaf7113e8c56e4d977eca204d57350d9493eda2710abefd2488a2b5d47c53344 sha256sums = 818ed42f4200ae13315587abf6f247f93e68c658a94794f73924c985cdc145d0 sha256sums = 21e77b6b18e14636f9827e1f8d45bbc8dba8fb14ea5f4cde285c1ef4bb01c85e - sha256sums = 029490b735ec0f5785a083f65172f6eece3fa64dad94b8b56f0db73c5418cfa2 + sha256sums = bd2faa933e409a7de53750c701020a301617f5220091f1a760a6d9f61d1c6556 pkgname = pycharm-professional diff --git a/PKGBUILD b/PKGBUILD index 5fd1aa2..b9844c6 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,8 +1,8 @@ # Maintainer: XavierCLL pkgname=pycharm-professional -pkgver=2019.1.3 -_pkgver=2019.1.3 +pkgver=2019.2.0 +_pkgver=2019.2 pkgrel=1 pkgdesc="Powerful Python and Django IDE. Professional Edition." arch=('x86_64') @@ -22,11 +22,11 @@ source=("https://download.jetbrains.com/python/$pkgname-$_pkgver.tar.gz" "charm.desktop" "charm") # https://download.jetbrains.com/python/pycharm-professional-${_pkgver}.tar.gz.sha256 -sha256sums=('8322de8b816895fcb7fd854e83d25084b0593ea2b90b5b4598a495ef2e958824' +sha256sums=('1940fce9f162b8a804672379345d6b4ec343d2ec65b3d3054bd088e8b1fdfbb4' 'aaf7113e8c56e4d977eca204d57350d9493eda2710abefd2488a2b5d47c53344' '818ed42f4200ae13315587abf6f247f93e68c658a94794f73924c985cdc145d0' '21e77b6b18e14636f9827e1f8d45bbc8dba8fb14ea5f4cde285c1ef4bb01c85e' - '029490b735ec0f5785a083f65172f6eece3fa64dad94b8b56f0db73c5418cfa2') + 'bd2faa933e409a7de53750c701020a301617f5220091f1a760a6d9f61d1c6556') makedepends=('python2-setuptools' 'python-setuptools') optdepends=('ipython2: For enhanced interactive Python shell v2 inside Pycharm' 'ipython: For enhanced interactive Python shell v3 inside Pycharm' diff --git a/charm b/charm old mode 100644 new mode 100755 index 109a7b7..2ca9560 --- a/charm +++ b/charm @@ -1,28 +1,53 @@ #!/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'~/.PyCharm2019.1/config' -SYSTEM_PATH = u'~/.PyCharm2019.1/system' +CONFIG_PATH = u'~/.PyCharm2019.2/config' +SYSTEM_PATH = u'~/.PyCharm2019.2/system' def print_usage(cmd): print(('Usage:\n' + ' {0} -h | -? | --help\n' + - ' {0} [project_dir]\n' + - ' {0} [-l|--line line] [project_dir|--temp-project] file[:line]\n' + + ' {0} [project_dir] [-w|--wait]\n' + + ' {0} [-l|--line line] [project_dir|--temp-project] [-w|--wait] file[:line]\n' + ' {0} diff \n' + ' {0} merge [base] ').format(cmd)) +def write_to_sock(sock, str): + if sys.version_info[0] >= 3: str = str.encode('utf-8') + sock.send(struct.pack('>h', len(str)) + str) + + +def read_from_sock(sock): + len = struct.unpack('>h', sock.recv(2))[0] + return sock.recv(len).decode('utf-8') + + +def read_sequence_from_sock(sock): + result = [] + while True: + try: + str = read_from_sock(sock) + if str == '---': + break + result.append(str) + + except (socket.error, IOError) as e: + print("I/O error({0}): {1} ({2})".format(e.errno, e.strerror, e)) + traceback.print_exception(*sys.exc_info()) + return result + return result + + def process_args(argv): args = [] @@ -36,6 +61,8 @@ def process_args(argv): elif arg == '-l' or arg == '--line': args.append(arg) skip_next = True + elif arg == '-w' or arg == '--wait': + args.append('--wait') elif skip_next: args.append(arg) skip_next = False @@ -67,30 +94,28 @@ def try_activate_instance(args): return False s = socket.socket() - s.settimeout(0.3) + s.settimeout(1.0) try: s.connect(('127.0.0.1', port)) except (socket.error, IOError): return False - found = False - while True: - try: - path_len = struct.unpack('>h', s.recv(2))[0] - path = s.recv(path_len).decode('utf-8') - if os.path.abspath(path) == os.path.abspath(CONFIG_PATH): - found = True - break - except (socket.error, IOError): - return False + paths = read_sequence_from_sock(s) + found = CONFIG_PATH in paths if found: - cmd = 'activate ' + token + '\0' + os.getcwd() + '\0' + '\0'.join(args) - if sys.version_info[0] >= 3: cmd = cmd.encode('utf-8') - encoded = struct.pack('>h', len(cmd)) + cmd - s.send(encoded) - time.sleep(0.5) # don't close the socket immediately - return True + write_to_sock(s, 'activate ' + token + '\0' + os.getcwd() + '\0' + '\0'.join(args)) + + s.settimeout(None) + response = read_sequence_from_sock(s) + if response[0] != 'ok': + print('bad response: ' + response) + exit(1) + + if len(response) > 2: + print(response[2]) + + exit(int(response[1])) return False