Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
thorsummoner
ttt_terrorcon
Commits
4621ff1f
Commit
4621ff1f
authored
Aug 08, 2021
by
dylan grafmyre
Browse files
just being pretty messed up, spaces in the gmod bin path (default) breaking lots
parent
816e5d25
Changes
3
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
4621ff1f
#
GAME
?=
hl2.exe
PYTHON_BIN
?=
./env/scripts/python
GAME_DIR
?=
D:
\\
Steam
\\
steamapps
\\
common
\\
GarrysMod
\\
SHLEX_BIN
?=
./contrib/shlex
SHLEX_FLAGS
?=
SHELL
=
C:
\\
Program
\
Files
\\
Git
\\
bin
\\
bash.exe
.SHELLFLAGS
=
-c
GAME
?=
hl2.exe
GAME_DIR
?=
C:
\\
Program Files
(
x86
)
\\
Steam
\\
steamapps
\\
common
\\
GarrysMod
\\
VBIN_DIR
?=
$(GAME_DIR)
bin
\\
MOD_DIR
?=
$(GAME_DIR)
garrysmod
\\
MOUNT_DIR
?=
.
\\
VBIN_FLAGS
?=
-game
$(MOD_DIR)
VBIN_FLAGS
?=
-game
"'
$(MOD_DIR)
'"
SUPERVISE_V_BIN
?=
./contrib/supervise-v
BSP_BIN
?=
$(SUPERVISE_V_BIN)
$(VBIN_DIR)
vbsp.exe
SUPERVISE_V_FLAGS
?=
--shlex
BSP_BIN
?=
$(SUPERVISE_V_BIN)
$(SUPERVISE_V_FLAGS)
"'
$(VBIN_DIR)
vbsp.exe'"
BSP_FLAGS
?=
$(VBIN_FLAGS)
VIS_BIN
?=
$(SUPERVISE_V_BIN)
$(VBIN_DIR)
vvis.exe
VIS_BIN
?=
$(SUPERVISE_V_BIN)
$(SUPERVISE_V_FLAGS)
"'
$(VBIN_DIR)
vvis.exe
'"
VIS_FLAGS
?=
$(VBIN_FLAGS)
-fast
RAD_BIN
?=
$(SUPERVISE_V_BIN)
$(VBIN_DIR)
vrad.exe
RAD_BIN
?=
$(SUPERVISE_V_BIN)
$(SUPERVISE_V_FLAGS)
"'
$(VBIN_DIR)
vrad.exe
'"
RAD_FLAGS
?=
$(VBIN_FLAGS)
-StaticPropLighting
-bounce
2
-noextra
# -StaticPropSampleScale 0.25
BSPZIP_BIN
?=
$(SUPERVISE_V_BIN)
$(VBIN_DIR)
bspzip.exe
BSPZIP_BIN
?=
$(SUPERVISE_V_BIN)
$(SUPERVISE_V_FLAGS)
"'
$(VBIN_DIR)
bspzip.exe
'"
BSPZIP_FLAGS
?=
$(VBIN_FLAGS)
GMAD_BIN
?=
$(VBIN_DIR)
gmad.exe
GMAD_BIN
?=
"
$(VBIN_DIR)
gmad.exe
"
GMAD_FLAGS
?=
GMPUBLISH_BIN
?=
$(VBIN_DIR)
gmpublish.exe
GMPUBLISH_BIN
?=
"
$(VBIN_DIR)
gmpublish.exe
"
GMPUBLISH_FLAGS
?=
GEN_BSPZIP_ADDLIST_BIN
?=
$(PYTHON_BIN)
./contrib/gen-bspzip-addlist
...
...
@@ -43,11 +50,11 @@ GMAD_TAR_FLAGS?=
ifeq
($(GAME),0)
echo
"user disabled run game via GAME=0"
else
$(GAME_DIR)$(GAME)
-allowdebug
$(VBIN_FLAGS)
+map
$(
notdir
$(
basename
$^
))
+gamemode terrortown +ttt_debug_preventwin 1 +ttt_preptime_seconds 10 +ttt_minimum_players 1
$(SHLEX_BIN)
$(SHLEX_FLAGS)
"'
$(GAME_DIR)$(GAME)
'"
-allowdebug
$(VBIN_FLAGS)
+map
$(
notdir
$(
basename
$^
))
+gamemode terrortown +ttt_debug_preventwin 1 +ttt_preptime_seconds 10 +ttt_minimum_players 1
endif
%.game-only
:
$(GAME_DIR)$(GAME)
-allowdebug
$(VBIN_FLAGS)
+map
$(
notdir
$(
basename
$@
))
+gamemode terrortown +ttt_debug_preventwin 1 +ttt_preptime_seconds 10 +ttt_minimum_players 1
$(SHLEX_BIN)
$(SHLEX_FLAGS)
"'
$(GAME_DIR)$(GAME)
'"
-allowdebug
$(VBIN_FLAGS)
+map
$(
notdir
$(
basename
$@
))
+gamemode terrortown +ttt_debug_preventwin 1 +ttt_preptime_seconds 10 +ttt_minimum_players 1
maps/%.bsp
:
%.bsp
...
...
contrib/shlex
0 → 100644
View file @
4621ff1f
#!/usr/bin/env python3
"""
shlex - execve but apply shlex to argv
"""
import
shlex
import
subprocess
import
logging
import
os
import
sys
import
argparse
LOGGER
=
logging
.
getLogger
(
os
.
path
.
basename
(
__file__
))
ARGP
=
argparse
.
ArgumentParser
()
ARGP
.
add_argument
(
'remainder'
,
nargs
=
argparse
.
REMAINDER
)
def
main
(
argp
=
None
,
argv
=
None
):
if
argp
is
None
:
argp
=
ARGP
.
parse_args
(
argv
)
logging
.
basicConfig
(
level
=
logging
.
INFO
)
LOGGER
.
info
(
'execve_orig: %r'
,
argp
.
remainder
)
execve
=
shlex
.
split
(
' '
.
join
(
argp
.
remainder
))
# + ['&', 'exit'] windows hack to get returncode?
LOGGER
.
info
(
'execve_shlex: %r'
,
execve
)
execve
=
[
(
os
.
path
.
normpath
(
i
)
if
os
.
path
.
isfile
(
i
)
else
i
)
for
i
in
execve
]
LOGGER
.
info
(
'execve_shlex_normpath: %r'
,
execve
)
cproc
=
subprocess
.
run
(
execve
,
shell
=
True
)
LOGGER
.
info
(
'execve_rc: %r'
,
cproc
.
returncode
)
return
cproc
.
returncode
if
__name__
==
'__main__'
:
exit
(
main
())
contrib/supervise-v
View file @
4621ff1f
...
...
@@ -6,18 +6,28 @@
arguments given in form
<prog> <args> <mapname>
"""
import
sys
import
os
import
hashlib
import
subprocess
import
logging
import
argparse
import
collections
import
copy
import
hashlib
import
logging
import
os
import
shlex
import
subprocess
import
sys
BELOW_NORMAL_PRIORITY_CLASS
=
0x00004000
LOGGER
=
logging
.
getLogger
(
'supervise-v'
)
ARGP
=
argparse
.
ArgumentParser
()
ARGP
.
add_argument
(
'--shlex'
,
action
=
'store_true'
,
help
=
'os is incapable of passing argv correctly, shlex yourself'
)
ARGP
.
add_argument
(
'remainder'
,
nargs
=
argparse
.
REMAINDER
)
def
execve_low
(
execve
,
*
args
,
**
kwargs
):
logging
.
info
(
'execve: %r'
,
execve
)
LOGGER
.
info
(
'execve: %r'
,
execve
)
bin_
=
execve
[
0
]
if
not
os
.
path
.
isfile
(
bin_
):
LOGGER
.
error
(
'is not file: %r'
,
bin_
)
return
subprocess
.
run
(
execve
,
*
args
,
...
...
@@ -46,10 +56,10 @@ class FileFingerprint:
self
.
hash
=
self
.
hashfile
()
def
hashfile
(
self
):
logging
.
info
(
'%r: hashing ...'
,
self
.
name
)
LOGGER
.
info
(
'%r: hashing ...'
,
self
.
name
)
with
open
(
self
.
name
,
'rb'
)
as
fh
:
hash_
=
hashfile
(
fh
)
logging
.
info
(
'%r: hashing ... done: %r'
,
self
.
name
,
hash_
.
hexdigest
())
LOGGER
.
info
(
'%r: hashing ... done: %r'
,
self
.
name
,
hash_
.
hexdigest
())
return
hash_
def
__eq__
(
self
,
other
):
...
...
@@ -76,8 +86,8 @@ class Argset:
'vrad'
:
BspCompileArgset
,
}
if
bin_name
not
in
BINMAP
:
raise
NotImplementedError
(
'no argset supervisor for bin {!r}'
.
format
(
bin_name
))
logging
.
info
(
'Argset for %r'
,
bin_name
)
raise
NotImplementedError
(
'no argset supervisor for bin
{!r}, argv:
{!r}'
.
format
(
bin_name
,
argv
))
LOGGER
.
info
(
'Argset for %r'
,
bin_name
)
return
BINMAP
[
bin_name
](
argv
)
def
supervise
(
self
):
...
...
@@ -103,12 +113,12 @@ class BspzipArgset(Argset):
assert
self
.
mode
==
'-addlist'
def
supervise
(
self
):
logging
.
info
(
'%s'
,
self
)
LOGGER
.
info
(
'%s'
,
self
)
if
not
os
.
path
.
isfile
(
self
.
ibsp
):
logging
.
info
(
'ENOENT no ibsp %r'
,
self
.
ibsp
)
LOGGER
.
info
(
'ENOENT no ibsp %r'
,
self
.
ibsp
)
return
2
if
not
os
.
path
.
isfile
(
self
.
addlist
):
logging
.
info
(
'ENOENT no addlist %r'
,
self
.
addlist
)
LOGGER
.
info
(
'ENOENT no addlist %r'
,
self
.
addlist
)
return
2
ifp
=
FileFingerprint
(
self
.
ibsp
)
...
...
@@ -122,7 +132,7 @@ class BspzipArgset(Argset):
])
if
not
os
.
path
.
isfile
(
self
.
obsp
):
logging
.
info
(
'ENOENT no obsp %r'
,
self
.
obsp
)
LOGGER
.
info
(
'ENOENT no obsp %r'
,
self
.
obsp
)
return
2
ofp
=
FileFingerprint
(
self
.
obsp
)
...
...
@@ -152,14 +162,14 @@ class BspCompileArgset(Argset):
if
self
.
has_bsp
:
ifp
=
FileFingerprint
(
self
.
bsp
)
else
:
logging
.
info
(
'no bsp file %r'
,
self
.
bsp
)
LOGGER
.
info
(
'no bsp file %r'
,
self
.
bsp
)
execve_low
(
[
self
.
bin_
]
+
self
.
vargs
+
[
self
.
file_
]
)
if
not
os
.
path
.
isfile
(
self
.
bsp
):
logging
.
info
(
'no bsp file %r'
,
self
.
bsp
)
LOGGER
.
info
(
'no bsp file %r'
,
self
.
bsp
)
return
2
ofp
=
FileFingerprint
(
self
.
bsp
)
...
...
@@ -167,9 +177,16 @@ class BspCompileArgset(Argset):
bsp_changed
=
(
ifp
==
ofp
)
return
bsp_changed
def
main
():
def
main
(
argp
=
None
,
argv
=
None
):
if
argp
is
None
:
argp
=
ARGP
.
parse_args
(
argv
)
logging
.
basicConfig
(
level
=
logging
.
INFO
)
argset
=
Argset
.
new_from_argv
(
sys
.
argv
)
if
argp
.
shlex
:
argv_orig
=
argp
.
remainder
argp
.
remainder
=
shlex
.
split
(
' '
.
join
(
argp
.
remainder
))
LOGGER
.
warning
(
'shlex: %r -> %r'
,
argv_orig
,
argp
.
remainder
)
argset
=
Argset
.
new_from_argv
([
sys
.
argv
[
0
]]
+
argp
.
remainder
)
exit
(
argset
.
supervise
())
if
__name__
==
'__main__'
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment