Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b561ac2577 | |||
| 7bab9f4a6b | |||
| 23a4b3794d | |||
|
|
d80ff553df | ||
|
|
88d06544c6 | ||
| ea7e642460 | |||
|
|
1db94a6c6b | ||
| 46f62367f5 | |||
|
|
439333ed59 | ||
| a249968a9d | |||
|
|
7d8d87b178 | ||
| 0c59a108f0 | |||
|
|
45d132c5ca | ||
| 0725782101 | |||
|
|
cd3a937423 | ||
|
|
5fdabae600 |
@@ -5,6 +5,7 @@ encoding//src/pygamecfg/common_ut.py=utf-8
|
||||
encoding//src/pygamecfg/core_gamecfg.py=utf-8
|
||||
encoding//src/pygamecfg/game_cod4.py=utf-8
|
||||
encoding//src/pygamecfg/game_cod4_gungame.py=utf-8
|
||||
encoding//src/pygamecfg/game_cod4_promod.py=utf-8
|
||||
encoding//src/pygamecfg/game_ut2k4.py=utf-8
|
||||
encoding//src/pygamecfg/game_ut99.py=utf-8
|
||||
encoding//src/pygamecfg/tool_ini.py=utf-8
|
||||
|
||||
18
Jenkinsfile
vendored
18
Jenkinsfile
vendored
@@ -184,7 +184,7 @@ pipeline {
|
||||
sh("virtualenv --pip=embed --setuptools=embed --wheel=embed --no-periodic-update --activators bash,python TOOLS_ENV")
|
||||
|
||||
sh(". ~/BUILD_ENV/bin/activate && pip install --upgrade setuptools build pip")
|
||||
sh(". ~/BUILD_ENV/bin/activate && pip install --upgrade 'copier==8.*' jinja2-slug toml")
|
||||
sh(". ~/BUILD_ENV/bin/activate && pip install --upgrade 'copier==9.*' jinja2-slug toml")
|
||||
|
||||
sh(". ~/TEST_ENV/bin/activate && pip install --upgrade pip")
|
||||
|
||||
@@ -426,9 +426,17 @@ pipeline {
|
||||
}
|
||||
post {
|
||||
always {
|
||||
dir("gitrepo") {
|
||||
publishCoverage adapters: [cobertura(mergeToOneReport: true, path: "helpers-results/cl_types_check/cobertura.xml")]
|
||||
junit 'helpers-results/cl_types_check/junit.xml'
|
||||
dir("gitrepo") {
|
||||
//publish coverage
|
||||
recordCoverage( sourceDirectories: [[path: 'src']],
|
||||
tools: [[parser: 'COBERTURA', pattern: 'helpers-results/cl_types_check/cobertura.xml']],
|
||||
id: 'COBERTURA', name: 'COBERTURA Coverage',
|
||||
sourceCodeRetention: 'EVERY_BUILD',)
|
||||
|
||||
//add type check to junit result set
|
||||
junit 'helpers-results/cl_types_check/junit.xml'
|
||||
|
||||
//publish html reports files
|
||||
publishHTML([
|
||||
reportDir: "helpers-results/cl_quality_check",
|
||||
reportFiles: "report.html",
|
||||
@@ -538,7 +546,7 @@ pipeline {
|
||||
dir("gitrepo") {
|
||||
junit 'helpers-results/cl_unit_test/*.xml'
|
||||
// using cobertura format (= coverage xml format)
|
||||
publishCoverage adapters: [cobertura(mergeToOneReport: true, path: "helpers-results/cl_unit_test_coverage/test_coverage.xml")]
|
||||
recordCoverage(tools: [[parser: 'COBERTURA', pattern: 'helpers-results/cl_unit_test_coverage/test_coverage.xml']])
|
||||
publishHTML([
|
||||
reportDir: "helpers-results/cl_unit_test_coverage",
|
||||
reportFiles: "index.html",
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<stringAttribute key="org.eclipse.debug.ui.ATTR_CONSOLE_ENCODING" value="UTF-8"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:pygamecfg/helpers_proxy}"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_OTHER_WORKING_DIRECTORY" value=""/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="--typecheck --qualitycheck"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="--qualitycheck"/>
|
||||
<stringAttribute key="org.python.pydev.debug.ATTR_INTERPRETER" value="__default"/>
|
||||
<stringAttribute key="org.python.pydev.debug.ATTR_PROJECT" value="pygamecfg"/>
|
||||
<stringAttribute key="process_factory_id" value="org.python.pydev.debug.processfactory.PyProcessFactory"/>
|
||||
|
||||
17
RUN_types.launch
Normal file
17
RUN_types.launch
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.python.pydev.debug.regularLaunchConfigurationType">
|
||||
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/pygamecfg/helpers_proxy"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="2"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.debug.ui.ATTR_CONSOLE_ENCODING" value="UTF-8"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:pygamecfg/helpers_proxy}"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_OTHER_WORKING_DIRECTORY" value=""/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="--typecheck"/>
|
||||
<stringAttribute key="org.python.pydev.debug.ATTR_INTERPRETER" value="__default"/>
|
||||
<stringAttribute key="org.python.pydev.debug.ATTR_PROJECT" value="pygamecfg"/>
|
||||
<stringAttribute key="process_factory_id" value="org.python.pydev.debug.processfactory.PyProcessFactory"/>
|
||||
</launchConfiguration>
|
||||
@@ -67,7 +67,7 @@ plugins:
|
||||
verbose: false
|
||||
exclude_pages:
|
||||
- LICENSE
|
||||
output_path: C:\Users\chacha\git\pygamecfg\helpers-results\doc_gen\site\pdf\manual.pdf
|
||||
output_path: C:\Users\chacha\git\pygamecfg\helpers-results\cl_doc_gen\site\pdf\manual.pdf
|
||||
markdown_extensions:
|
||||
- def_list
|
||||
- tables
|
||||
@@ -114,8 +114,8 @@ markdown_extensions:
|
||||
- footnotes
|
||||
- pymdownx.superfences
|
||||
- pymdownx.emoji:
|
||||
emoji_index: !!python/name:materialx.emoji.twemoji
|
||||
emoji_generator: !!python/name:materialx.emoji.to_svg
|
||||
emoji_index: !!python/name:materialx.emoji.twemoji ''
|
||||
emoji_generator: !!python/name:materialx.emoji.to_svg ''
|
||||
extra:
|
||||
branch: master
|
||||
repository: pygamecfg
|
||||
|
||||
@@ -48,21 +48,34 @@ include-package-data = true
|
||||
where = ["src"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
"pygamecfg.data" = ["*.*"]
|
||||
"pysimpleini" = ["py.typed"]
|
||||
|
||||
# [[tool.mypy.overrides]]
|
||||
# module = ""
|
||||
# ignore_missing_imports = true
|
||||
|
||||
[tool.coverage.run]
|
||||
cover_pylib = false
|
||||
branch = true
|
||||
data_file="helpers-results/cl_unit_test_raw_coverage/.coverage"
|
||||
# debug = ["config","multiproc","process"]
|
||||
parallel = true
|
||||
concurrency = [
|
||||
'thread'
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://chacha.ddns.net/gitea/chacha/pygamecfg"
|
||||
Documentation = "https://chacha.ddns.net/mkdocs-web/chacha/pygamecfg/master/latest/"
|
||||
Tracker = "https://chacha.ddns.net/gitea/chacha/pygamecfg/issues"
|
||||
|
||||
[project.optional-dependencies]
|
||||
test = ["chacha_cicd_helper@git+https://chacha.ddns.net/gitea/chacha/chacha_cicd_helper.git@master"]
|
||||
coverage-check = ["chacha_cicd_helper@git+https://chacha.ddns.net/gitea/chacha/chacha_cicd_helper.git@master"]
|
||||
complexity-check = ["chacha_cicd_helper@git+https://chacha.ddns.net/gitea/chacha/chacha_cicd_helper.git@master"]
|
||||
quality-check = ["chacha_cicd_helper@git+https://chacha.ddns.net/gitea/chacha/chacha_cicd_helper.git@master"]
|
||||
type-check = ["chacha_cicd_helper@git+https://chacha.ddns.net/gitea/chacha/chacha_cicd_helper.git@master"]
|
||||
doc-gen = ["chacha_cicd_helper@git+https://chacha.ddns.net/gitea/chacha/chacha_cicd_helper.git@master"]
|
||||
test = ["chacha_cicd_helper"]
|
||||
coverage-check = ["chacha_cicd_helper"]
|
||||
complexity-check = ["chacha_cicd_helper"]
|
||||
quality-check = ["chacha_cicd_helper"]
|
||||
type-check = ["chacha_cicd_helper"]
|
||||
doc-gen = ["chacha_cicd_helper"]
|
||||
|
||||
# [project.scripts]
|
||||
# my-script = "my_package.module:function"
|
||||
|
||||
@@ -40,5 +40,6 @@ except PackageNotFoundError: # pragma: no cover
|
||||
from .core_gamecfg import GameOptions_Factory
|
||||
from . import game_cod4
|
||||
from . import game_cod4_gungame
|
||||
from . import game_cod4_promod
|
||||
from . import game_ut99
|
||||
from . import game_ut2k4
|
||||
|
||||
@@ -57,7 +57,7 @@ class pygamecfg_args(Tap):
|
||||
verbosity: int = 0
|
||||
basegamedir: str = "./"
|
||||
configfile: str = ""
|
||||
game: Literal["ut99", "cod4", "cod4_gungame", "ut2k4"]
|
||||
game: Literal["ut99", "cod4", "cod4_gungame", "cod4_promod", "ut2k4"]
|
||||
|
||||
def configure(self) -> None:
|
||||
self.add_argument("-v", "--verbosity", action="count", help="increase output verbosity")
|
||||
@@ -89,7 +89,7 @@ def fct_main(i_args: list[str]) -> None:
|
||||
args.configfile = "./System/UnrealTournament.ini"
|
||||
if args.game == "ut2k4":
|
||||
args.configfile = "./System/UT2004.ini"
|
||||
elif args.game in ("cod4", "cod4_gungame"):
|
||||
elif args.game in ("cod4", "cod4_gungame", "cod4_promod"):
|
||||
args.configfile = "./main/server.cfg"
|
||||
|
||||
GameOptions = GameOptions_Factory(args.game, args.basegamedir, args.configfile)
|
||||
|
||||
@@ -39,7 +39,7 @@ class GameOption_COD4(GameOption):
|
||||
self.cfgfile = open(self.mainConfigFilePath, "r", encoding="utf8") # pylint: disable=consider-using-with
|
||||
|
||||
def format_OT_BOOLEAN(self, value: Union[int, str, float]) -> str:
|
||||
return "1" if bool(value) is True else "0"
|
||||
return "1" if super().format_OT_BOOLEAN(value).lower() == "true" else "0"
|
||||
|
||||
def close(self) -> None:
|
||||
self.cfgfile.close()
|
||||
@@ -668,3 +668,36 @@ class GameOption_COD4_nosteamnames(GameOption_COD4):
|
||||
szPrefix = "set"
|
||||
szDefaultValue = "1"
|
||||
szHelp = "1 = Use names from steam if steam is available"
|
||||
|
||||
|
||||
@GameOptions_Factory_Register
|
||||
class GameOption_COD4_punkbuster(GameOption_COD4):
|
||||
TValueType = OptionType.OT_BOOLEAN
|
||||
szOptionName: str = "punkbuster"
|
||||
szKeyName: str = "sv_punkbuster"
|
||||
bDblQuoted: bool = True
|
||||
szPrefix = "set"
|
||||
szDefaultValue = "1"
|
||||
szHelp = "Enable Punkbuste (PB is not supported on CoD4x)"
|
||||
|
||||
|
||||
@GameOptions_Factory_Register
|
||||
class GameOption_COD4_pure(GameOption_COD4):
|
||||
TValueType = OptionType.OT_BOOLEAN
|
||||
szOptionName: str = "pure"
|
||||
szKeyName: str = "sv_pure"
|
||||
bDblQuoted: bool = True
|
||||
szPrefix = "set"
|
||||
szDefaultValue = "1"
|
||||
szHelp = "check IWD-data 0 = off, 1 = on"
|
||||
|
||||
|
||||
@GameOptions_Factory_Register
|
||||
class GameOption_COD4_antilag(GameOption_COD4):
|
||||
TValueType = OptionType.OT_BOOLEAN
|
||||
szOptionName: str = "antilag"
|
||||
szKeyName: str = "g_antilag"
|
||||
bDblQuoted: bool = True
|
||||
szPrefix = "set"
|
||||
szDefaultValue = "1"
|
||||
szHelp = "0 = off, 1 = on // Anti lag checks for weapon hits"
|
||||
|
||||
43
src/pygamecfg/game_cod4_promod.py
Normal file
43
src/pygamecfg/game_cod4_promod.py
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# pyGameCFG(c) by chacha
|
||||
#
|
||||
# pyGameCFG is licensed under a
|
||||
# Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Unported License.
|
||||
#
|
||||
# You should have received a copy of the license along with this
|
||||
# work. If not, see <https://creativecommons.org/licenses/by-nc-sa/4.0/>.
|
||||
|
||||
# pylint: disable=missing-class-docstring,missing-module-docstring,missing-function-docstring,duplicate-code,line-too-long
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from .core_gamecfg import GameOptions_Factory_Register, OptionType
|
||||
from .game_cod4 import GameOption_COD4
|
||||
|
||||
|
||||
class GameOption_COD4_ProMod(GameOption_COD4):
|
||||
szGameType = "cod4_promod"
|
||||
|
||||
|
||||
@GameOptions_Factory_Register
|
||||
class GameOption_COD4_ProMod_promod_mode(GameOption_COD4_ProMod):
|
||||
TValueType = OptionType.OT_STRING
|
||||
szOptionName: str = "promod_mode"
|
||||
szKeyName: str = "promod_mode"
|
||||
bDblQuoted: bool = True
|
||||
szPrefix = "set"
|
||||
szDefaultValue = "comp_public"
|
||||
szHelp = """comp_public,custom_public,2v2_mr,1v1_mr,knockout_mr,match_mr"""
|
||||
|
||||
|
||||
@GameOptions_Factory_Register
|
||||
class GameOption_COD4_ProMod_promod_enable_scorebot(GameOption_COD4_ProMod):
|
||||
TValueType = OptionType.OT_BOOLEAN
|
||||
szOptionName: str = "promod_enable_scorebot"
|
||||
szKeyName: str = "promod_enable_scorebot"
|
||||
bDblQuoted: bool = True
|
||||
szPrefix = "set"
|
||||
szDefaultValue = "0"
|
||||
szHelp = """match-modes only"""
|
||||
@@ -61,7 +61,7 @@ class Testtest_cod4(unittest.TestCase):
|
||||
# /!\ add '\n' at the end of the string cause Python terminal newline is always this, regardless Windows / Linux os.linesep
|
||||
self.assertEqual("17\n", capted_stdout.getvalue())
|
||||
self.assertEqual("", capted_stderr.getvalue())
|
||||
# check if other key still there / untouched
|
||||
# check if *other* key still there / untouched
|
||||
self.test_normal_READ_sv_mapRotation()
|
||||
|
||||
def test_defect_READ_net_port_NONEXISTS(self):
|
||||
@@ -74,3 +74,40 @@ class Testtest_cod4(unittest.TestCase):
|
||||
fct_main(["-g", "cod4", "-b", "test/tmp/COD4", "GetOption", "net_port"])
|
||||
self.assertEqual("132\n", capted_stdout.getvalue())
|
||||
self.assertEqual("", capted_stderr.getvalue())
|
||||
|
||||
def test_normal_WRITE_oldschool(self):
|
||||
with redirect_stdout(StringIO()) as capted_stdout, redirect_stderr(StringIO()) as capted_stderr:
|
||||
fct_main(["-g", "cod4", "-b", "test/tmp/COD4", "SetOption", "oldschool", "1"])
|
||||
# /!\ add '\n' at the end of the string cause Python terminal newline is always this, regardless Windows / Linux os.linesep
|
||||
self.assertEqual("setting option <oldschool> to: 1\n", capted_stdout.getvalue())
|
||||
self.assertEqual("", capted_stderr.getvalue())
|
||||
|
||||
with redirect_stdout(StringIO()) as capted_stdout, redirect_stderr(StringIO()) as capted_stderr:
|
||||
fct_main(["-g", "cod4", "-b", "test/tmp/COD4", "GetOption", "oldschool"])
|
||||
# /!\ add '\n' at the end of the string cause Python terminal newline is always this, regardless Windows / Linux os.linesep
|
||||
self.assertEqual("1\n", capted_stdout.getvalue())
|
||||
self.assertEqual("", capted_stderr.getvalue())
|
||||
|
||||
with redirect_stdout(StringIO()) as capted_stdout, redirect_stderr(StringIO()) as capted_stderr:
|
||||
fct_main(["-g", "cod4", "-b", "test/tmp/COD4", "SetOption", "oldschool", "0"])
|
||||
# /!\ add '\n' at the end of the string cause Python terminal newline is always this, regardless Windows / Linux os.linesep
|
||||
self.assertEqual("setting option <oldschool> to: 0\n", capted_stdout.getvalue())
|
||||
self.assertEqual("", capted_stderr.getvalue())
|
||||
|
||||
with redirect_stdout(StringIO()) as capted_stdout, redirect_stderr(StringIO()) as capted_stderr:
|
||||
fct_main(["-g", "cod4", "-b", "test/tmp/COD4", "GetOption", "oldschool"])
|
||||
# /!\ add '\n' at the end of the string cause Python terminal newline is always this, regardless Windows / Linux os.linesep
|
||||
self.assertEqual("0\n", capted_stdout.getvalue())
|
||||
self.assertEqual("", capted_stderr.getvalue())
|
||||
|
||||
with redirect_stdout(StringIO()) as capted_stdout, redirect_stderr(StringIO()) as capted_stderr:
|
||||
fct_main(["-g", "cod4", "-b", "test/tmp/COD4", "SetOption", "oldschool", "1"])
|
||||
# /!\ add '\n' at the end of the string cause Python terminal newline is always this, regardless Windows / Linux os.linesep
|
||||
self.assertEqual("setting option <oldschool> to: 1\n", capted_stdout.getvalue())
|
||||
self.assertEqual("", capted_stderr.getvalue())
|
||||
|
||||
with redirect_stdout(StringIO()) as capted_stdout, redirect_stderr(StringIO()) as capted_stderr:
|
||||
fct_main(["-g", "cod4", "-b", "test/tmp/COD4", "GetOption", "oldschool"])
|
||||
# /!\ add '\n' at the end of the string cause Python terminal newline is always this, regardless Windows / Linux os.linesep
|
||||
self.assertEqual("1\n", capted_stdout.getvalue())
|
||||
self.assertEqual("", capted_stderr.getvalue())
|
||||
|
||||
Reference in New Issue
Block a user