Update charm
This commit is contained in:
parent
4c161e0f59
commit
94677b4700
4
.SRCINFO
4
.SRCINFO
@ -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
|
||||
|
||||
|
2
PKGBUILD
2
PKGBUILD
@ -39,7 +39,7 @@ sha256sums=('36d615f795e9fb62c82c7d9d988ee6c529f9c09aac228f9b45fd832a9fb482a8'
|
||||
'c1a74303d9e870918bd8068f761c8251b996694b1b96b3537fbca317679c4958'
|
||||
'ad59415f8ac2c623f9c61453caf70bf75b6b14db2f09807e4ea339a2dc740be9'
|
||||
'a90a2b645e733627fefe568ae82fc96716772c13b4431760a822c0c64b0596e9'
|
||||
'0d6c311067aa925e4f73ab41f4955b033dbc00e0a65c940ceb27e6dae5bb7bb0')
|
||||
'f31a41ab02ba39a08aa218b1239ff7a0156e3b7d68c109eb0249ac6d1db32331')
|
||||
|
||||
package() {
|
||||
# base
|
||||
|
59
charm
59
charm
@ -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()
|
||||
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()
|
||||
|
||||
f = open(token_path)
|
||||
token = f.read()
|
||||
f.close()
|
||||
|
||||
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:
|
||||
print('No IDE instance has been found. New one will be started.')
|
||||
port = -1
|
||||
|
||||
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()
|
||||
|
||||
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)
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user