-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstants.py
65 lines (52 loc) · 2.11 KB
/
constants.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Borrowed from Psychopy
# https://github.com/psychopy/psychopy
# instead of import *, use this (+ PSYCHOPY_USERAGENT if you need that)
# (NOT_STARTED, STARTED, PLAYING, PAUSED, STOPPED, FINISHED, PRESSED,
# RELEASED, FOREVER)
from __future__ import absolute_import, print_function
import sys
import os
import copy
from os.path import abspath, join
PY3 = False
NOT_STARTED = 0
PLAYING = 1
STARTED = PLAYING
PAUSED = 2
STOPPED = -1
FINISHED = STOPPED
SKIP = -2
# for button box:
PRESSED = 1
RELEASED = -1
# while t < FOREVER ... -- in scripts generated by Builder
FOREVER = 1000000000 # seconds
# USERAGENT is for consistent http-related self-identification across an app.
# It shows up in server logs on the receiving end. Currently the value (and
# its use from psychopy) is arbitrary and optional. Having it standardized
# and fixed will also help people who develop their own http-log analysis
# tools for use with contrib.http.upload()
PSYCHOPY_USERAGENT = ("PsychoPy: open-source Psychology & Neuroscience tools; "
"www.psychopy.org")
# find a copy of git if possible to do push/pull as needed
# the pure-python dulwich lib can do most things but merged push/pull
# isn't currently possible (e.g. pull overwrites any local commits!)
# see https://github.com/dulwich/dulwich/issues/666
ENVIRON = copy.copy(os.environ)
gitExe = None
if sys.platform == 'darwin':
_gitStandalonePath = abspath(join(sys.executable, '..', '..',
'Resources', 'git-core'))
if os.path.exists(_gitStandalonePath):
ENVIRON["PATH"] = "{}:".format(_gitStandalonePath) + ENVIRON["PATH"]
gitExe = join(_gitStandalonePath, 'git')
elif sys.platform == 'win32':
_gitStandalonePath = abspath(join(sys.executable, '..', 'MinGit', 'cmd'))
if os.path.exists(_gitStandalonePath):
ENVIRON["PATH"] = "{};".format(_gitStandalonePath) + ENVIRON["PATH"]
os.environ["GIT_PYTHON_GIT_EXECUTABLE"] = _gitStandalonePath
gitExe = join(_gitStandalonePath, 'git.exe')
if gitExe:
os.environ["GIT_PYTHON_GIT_EXECUTABLE"] = gitExe