unknown-cli 0.9.37__tar.gz → 0.9.41__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. {unknown-cli-0.9.37/unknown_cli.egg-info → unknown_cli-0.9.41}/PKG-INFO +2 -2
  2. {unknown-cli-0.9.37 → unknown_cli-0.9.41}/README.md +2 -2
  3. {unknown-cli-0.9.37 → unknown_cli-0.9.41}/setup.py +101 -101
  4. {unknown-cli-0.9.37 → unknown_cli-0.9.41/unknown_cli.egg-info}/PKG-INFO +1 -1
  5. {unknown-cli-0.9.37 → unknown_cli-0.9.41}/unknown_cli.egg-info/SOURCES.txt +0 -1
  6. unknown_cli-0.9.41/unknowncli/VERSION +1 -0
  7. {unknown-cli-0.9.37 → unknown_cli-0.9.41}/unknowncli/__init__.py +16 -16
  8. {unknown-cli-0.9.37 → unknown_cli-0.9.41}/unknowncli/commands/preflight.py +5 -1
  9. {unknown-cli-0.9.37 → unknown_cli-0.9.41}/unknowncli/data/.p4ignore.txt +152 -152
  10. unknown-cli-0.9.37/unknowncli/VERSION +0 -1
  11. unknown-cli-0.9.37/unknowncli/commands/xbox.py +0 -497
  12. {unknown-cli-0.9.37 → unknown_cli-0.9.41}/setup.cfg +0 -0
  13. {unknown-cli-0.9.37 → unknown_cli-0.9.41}/unknown_cli.egg-info/dependency_links.txt +0 -0
  14. {unknown-cli-0.9.37 → unknown_cli-0.9.41}/unknown_cli.egg-info/entry_points.txt +0 -0
  15. {unknown-cli-0.9.37 → unknown_cli-0.9.41}/unknown_cli.egg-info/requires.txt +0 -0
  16. {unknown-cli-0.9.37 → unknown_cli-0.9.41}/unknown_cli.egg-info/top_level.txt +0 -0
  17. {unknown-cli-0.9.37 → unknown_cli-0.9.41}/unknowncli/__main__.py +0 -0
  18. {unknown-cli-0.9.37 → unknown_cli-0.9.41}/unknowncli/commands/__init__.py +0 -0
  19. {unknown-cli-0.9.37 → unknown_cli-0.9.41}/unknowncli/commands/project.py +0 -0
  20. {unknown-cli-0.9.37 → unknown_cli-0.9.41}/unknowncli/commands/task.py +0 -0
  21. {unknown-cli-0.9.37 → unknown_cli-0.9.41}/unknowncli/commands/unreal.py +0 -0
  22. {unknown-cli-0.9.37 → unknown_cli-0.9.41}/unknowncli/set_registry_keys.py +0 -0
  23. {unknown-cli-0.9.37 → unknown_cli-0.9.41}/unknowncli/set_url_handler.py +0 -0
  24. {unknown-cli-0.9.37 → unknown_cli-0.9.41}/unknowncli/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
- Name: unknown-cli
3
- Version: 0.9.37
2
+ Name: unknown_cli
3
+ Version: 0.9.41
4
4
  Summary: Unknown Commandline Tool
5
5
  Home-page: UNKNOWN
6
6
  Author:
@@ -1,3 +1,3 @@
1
- # Unknown CLI
2
-
1
+ # Unknown CLI
2
+
3
3
  Internal tool
@@ -1,101 +1,101 @@
1
- #!/usr/bin/env python
2
- import os, sys
3
- from setuptools import setup, find_packages, Command
4
-
5
- if sys.version_info < (3, 8):
6
- raise NotImplementedError("""This tool does not support Python versions older than 3.6""")
7
-
8
-
9
- version_file = os.path.abspath(os.path.join("unknowncli", "VERSION"))
10
-
11
-
12
- def get_version():
13
- with open(version_file) as f:
14
- return f.readlines()[0].strip()
15
-
16
-
17
- class BumpCommand(Command):
18
- description = "Version bump"
19
- user_options = [("which=", None, "Specify which part of the version to bump")]
20
-
21
- def initialize_options(self):
22
- self.which = None
23
-
24
- def finalize_options(self):
25
- assert self.which in (None, "major", "minor", "patch"), "Invalid bump pragma"
26
-
27
- def run(self):
28
- bump_version(self.which)
29
-
30
-
31
- def bump_version(which):
32
- major, minor, patch = (0, 1, 0)
33
- old_version = get_version()
34
- major, minor, patch = old_version.split(".")
35
-
36
- if which == "major":
37
- major = int(major) + 1
38
- minor = 0
39
- patch = 0
40
- elif which == "minor":
41
- minor = int(minor) + 1
42
- patch = 0
43
- else:
44
- patch = int(patch.split("-")[0]) + 1
45
-
46
- new_version = "%s.%s.%s" % (major, minor, patch)
47
-
48
- with open(version_file, "w") as f:
49
- f.write(new_version)
50
- print(f"Version has been bumped from {old_version} to {new_version}")
51
-
52
-
53
- with open("README.md", "r") as fh:
54
- long_description = fh.read()
55
-
56
- version = get_version()
57
-
58
- setup(
59
- name="unknown-cli",
60
- python_requires=">=3.6",
61
- version=version,
62
- license="MIT",
63
- author="",
64
- author_email="",
65
- description="Unknown Commandline Tool",
66
- long_description=long_description,
67
- long_description_content_type="text/markdown",
68
- url="",
69
- packages=find_packages(exclude=["tests"]),
70
- package_data={"": ["VERSION", "data/.p4ignore.txt"]},
71
- install_requires=[
72
- "typer",
73
- "click",
74
- "requests",
75
- "boto3",
76
- "psutil",
77
- "jsonpath-rw",
78
- "pyyaml",
79
- "pyjwt",
80
- "tabulate",
81
- "colorama",
82
- "shellingham",
83
- "boto3",
84
- "loguru",
85
- "P4Python",
86
- "rich",
87
- "pyuac",
88
- "pywin32"
89
- ],
90
- extras_require={},
91
- include_package_data=False,
92
- classifiers=[
93
- "Intended Audience :: Developers",
94
- "License :: OSI Approved :: MIT License",
95
- "Operating System :: OS Independent",
96
- "Programming Language :: Python :: 3",
97
- ],
98
- test_suite="tests",
99
- cmdclass={"bump": BumpCommand},
100
- entry_points={"console_scripts": ["unknown = unknowncli.__main__:app", "unk = unknowncli.__main__:app"]},
101
- )
1
+ #!/usr/bin/env python
2
+ import os, sys
3
+ from setuptools import setup, find_packages, Command
4
+
5
+ if sys.version_info < (3, 8):
6
+ raise NotImplementedError("""This tool does not support Python versions older than 3.6""")
7
+
8
+
9
+ version_file = os.path.abspath(os.path.join("unknowncli", "VERSION"))
10
+
11
+
12
+ def get_version():
13
+ with open(version_file) as f:
14
+ return f.readlines()[0].strip()
15
+
16
+
17
+ class BumpCommand(Command):
18
+ description = "Version bump"
19
+ user_options = [("which=", None, "Specify which part of the version to bump")]
20
+
21
+ def initialize_options(self):
22
+ self.which = None
23
+
24
+ def finalize_options(self):
25
+ assert self.which in (None, "major", "minor", "patch"), "Invalid bump pragma"
26
+
27
+ def run(self):
28
+ bump_version(self.which)
29
+
30
+
31
+ def bump_version(which):
32
+ major, minor, patch = (0, 1, 0)
33
+ old_version = get_version()
34
+ major, minor, patch = old_version.split(".")
35
+
36
+ if which == "major":
37
+ major = int(major) + 1
38
+ minor = 0
39
+ patch = 0
40
+ elif which == "minor":
41
+ minor = int(minor) + 1
42
+ patch = 0
43
+ else:
44
+ patch = int(patch.split("-")[0]) + 1
45
+
46
+ new_version = "%s.%s.%s" % (major, minor, patch)
47
+
48
+ with open(version_file, "w") as f:
49
+ f.write(new_version)
50
+ print(f"Version has been bumped from {old_version} to {new_version}")
51
+
52
+
53
+ with open("README.md", "r") as fh:
54
+ long_description = fh.read()
55
+
56
+ version = get_version()
57
+
58
+ setup(
59
+ name="unknown_cli",
60
+ python_requires=">=3.6",
61
+ version=version,
62
+ license="MIT",
63
+ author="",
64
+ author_email="",
65
+ description="Unknown Commandline Tool",
66
+ long_description=long_description,
67
+ long_description_content_type="text/markdown",
68
+ url="",
69
+ packages=find_packages(exclude=["tests"]),
70
+ package_data={"": ["VERSION", "data/.p4ignore.txt"]},
71
+ install_requires=[
72
+ "typer",
73
+ "click",
74
+ "requests",
75
+ "boto3",
76
+ "psutil",
77
+ "jsonpath-rw",
78
+ "pyyaml",
79
+ "pyjwt",
80
+ "tabulate",
81
+ "colorama",
82
+ "shellingham",
83
+ "boto3",
84
+ "loguru",
85
+ "P4Python",
86
+ "rich",
87
+ "pyuac",
88
+ "pywin32"
89
+ ],
90
+ extras_require={},
91
+ include_package_data=False,
92
+ classifiers=[
93
+ "Intended Audience :: Developers",
94
+ "License :: OSI Approved :: MIT License",
95
+ "Operating System :: OS Independent",
96
+ "Programming Language :: Python :: 3",
97
+ ],
98
+ test_suite="tests",
99
+ cmdclass={"bump": BumpCommand},
100
+ entry_points={"console_scripts": ["unknown = unknowncli.__main__:app", "unk = unknowncli.__main__:app"]},
101
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unknown-cli
3
- Version: 0.9.37
3
+ Version: 0.9.41
4
4
  Summary: Unknown Commandline Tool
5
5
  Home-page: UNKNOWN
6
6
  Author:
@@ -17,5 +17,4 @@ unknowncli/commands/preflight.py
17
17
  unknowncli/commands/project.py
18
18
  unknowncli/commands/task.py
19
19
  unknowncli/commands/unreal.py
20
- unknowncli/commands/xbox.py
21
20
  unknowncli/data/.p4ignore.txt
@@ -0,0 +1 @@
1
+ 0.9.41
@@ -1,16 +1,16 @@
1
- import os
2
- from typer import Typer, Context, Argument, Option, echo, secho, confirm
3
-
4
-
5
- def read_version():
6
- directory = os.path.dirname(__file__)
7
- with open(os.path.join(directory, "VERSION"), "r") as version_file:
8
- version = version_file.readline().strip()
9
- return version
10
-
11
-
12
- __version__ = read_version()
13
-
14
-
15
- def get_version_string():
16
- return f"unknown-cli/{__version__}"
1
+ import os
2
+ from typer import Typer, Context, Argument, Option, echo, secho, confirm
3
+
4
+
5
+ def read_version():
6
+ directory = os.path.dirname(__file__)
7
+ with open(os.path.join(directory, "VERSION"), "r") as version_file:
8
+ version = version_file.readline().strip()
9
+ return version
10
+
11
+
12
+ __version__ = read_version()
13
+
14
+
15
+ def get_version_string():
16
+ return f"unknown-cli/{__version__}"
@@ -926,8 +926,12 @@ def main(
926
926
  shelve_changelist, type=type, stream=get_client_stream(change_obj.client), print_output=verbose, submit_on_server=(use_server_submit and commit_on_success), content_only_build=use_content_build
927
927
  )
928
928
 
929
+ if type == PreflightType.QUICK:
930
+ secho("\n** Quick Build Preflight is being used!", fg="yellow", bg="black", bold=True)
931
+ secho("** If your preflight should test cooking please cancel and run a Full Build Preflight from P4V.", fg="yellow", bg="black", bold=True)
932
+
929
933
  if use_server_submit:
930
- secho("\nBuild is requested, it is safe to close this window at any time!\n")
934
+ secho("\nBuild is requested, it is safe to close this window at any time!\n", fg="white", bg="black", bold=True)
931
935
 
932
936
  wait_on_teamcity_build(build_id, shelve_changelist, use_server_submit)
933
937
 
@@ -1,152 +1,152 @@
1
- # Here you can specify files to ignore when adding files to the depot.
2
- #
3
- # The syntax for P4IGNORE files is not the same as Perforce syntax.
4
- # Instead, it is similar to that used by other versioning systems:
5
- #
6
- # - Files are specified in local syntax
7
- # - a # character at the beginning of a line denotes a comment
8
- # - a ! character at the beginning of a line excludes the file specification
9
- # - a * wildcard matches substrings.
10
- #
11
- # http://stackoverflow.com/questions/18240084/how-does-perforce-ignore-file-syntax-differ-from-gitignore-syntax
12
-
13
- /*.sln
14
- /.p4sync.txt
15
-
16
- # Ignore all Visual Studio temp files.
17
- *.suo
18
- *.opensdf
19
- *.sdf
20
- .patch_*
21
-
22
- */DerivedDataCache/
23
- **/DerivedDataCache/Boot.ddc
24
- **/DerivedDataCache/**/*.udd
25
-
26
- # Ignore all Intermediate and Saved directories
27
- */Intermediate/*
28
- */Saved/*
29
-
30
- # Ignore UBT's configuration.xml
31
- Engine/Programs/UnrealBuildTool/*
32
- *.uatbuildrecord
33
- *.tmp
34
-
35
- # Ignore built binaries and temporary build files
36
- */obj/*
37
- *.csprojAssemblyReference.cache
38
-
39
- # Ignore UBT's log output files
40
- /Engine/Programs/UnrealBuildTool/*.txt
41
-
42
- # Ignore Python cached files
43
- *.pyc
44
-
45
- # Ignore JetBrain's IDE folders
46
- .idea/
47
- .gradle/
48
-
49
- # Ignore autogenerated files from HoloLens WMRInterop
50
- /Engine/Source/ThirdParty/WindowsMixedRealityInterop/packages/*
51
- /Engine/Source/ThirdParty/WindowsMixedRealityInterop/MixedRealityInteropHoloLens/Generated Files/*
52
- /Engine/Source/ThirdParty/WindowsMixedRealityInterop/MixedRealityInteropHoloLens/x64/*
53
- /Engine/Source/ThirdParty/WindowsMixedRealityInterop/MixedRealityInteropHoloLens/ARM64/*
54
- /Engine/Source/ThirdParty/WindowsMixedRealityInterop/MixedRealityInterop/x64/*
55
- /Engine/Source/ThirdParty/WindowsMixedRealityInterop/MixedRealityInterop/ARM64/*
56
-
57
- Saved/
58
- LocalBuilds/
59
- *.csproj.*
60
- .vs/*
61
- .vsconfig
62
- *.pdb
63
- *.suo
64
- *.opensdf
65
- *.sdf
66
- *.tmp
67
- *.mdb
68
- obj/
69
- *.vcxproj
70
- *.sln
71
- *-Debug.*
72
- FileOpenOrder/
73
- *.xcworkspace
74
- *.xcodeproj
75
- ./Makefile
76
- ./CMakeLists.txt
77
- .ue4dependencies
78
- Samples/*
79
- FeaturePacks/*
80
- Templates/*
81
- Engine/Documentation/*
82
-
83
- # Engine intermediates
84
- Engine/Intermediate/*
85
- Intermediate/
86
-
87
- # Intermediate folders for programs should not be checked in
88
- Engine\Programs\*\Intermediate\*
89
-
90
- # Intermediate folders created for various C# programs
91
- Engine\Source\Programs\*\obj\*
92
-
93
- # Saved folders for programs should not be checked in
94
- Engine\Programs\*\Saved\*
95
- Engine\Programs\UnrealBuildTool\*
96
-
97
- # Derived data cache should never be checked in
98
- Engine/DerivedDataCache/*
99
-
100
- # Ignore any build receipts
101
- Engine/Build/Receipts/*
102
-
103
- # Ignore personal workspace vars
104
- p4config.txt
105
-
106
- # Ignore Unix backup files
107
- *~
108
-
109
- # Ignore Mac desktop services store files
110
- .DS_Store
111
-
112
- # Ignore crash reports
113
- crashinfo--*
114
-
115
- # Ignore linux project files
116
- *.user
117
- *.pro
118
- *.pri
119
- *.kdev4
120
-
121
- # Obj-C/Swift specific
122
- *.hmap
123
- *.ipa
124
- *.dSYM.zip
125
- *.dSYM
126
-
127
- # Ignore documentation generated for C# tools
128
- Engine/Binaries/DotNET/UnrealBuildTool.xml
129
- Engine/Binaries/DotNET/AutomationScripts/BuildGraph.Automation.xml
130
-
131
- # Ignore version files in the Engine/Binaries directory created by UBT
132
- /Engine/Binaries/**/*.version
133
-
134
- # Ignore exp files in the the Engine/Binaries directory as they aren't C/C++ source files
135
- /Engine/Binaries/**/*.exp
136
-
137
- # Ignore Swarm local save files
138
- Engine/Binaries/DotNET/SwarmAgent.DeveloperOptions.xml
139
- Engine/Binaries/DotNET/SwarmAgent.Options.xml
140
-
141
- # Intermediary Files
142
- *.target.xml
143
- *.exe.config
144
- *.exe.manifest
145
-
146
- # Ignore project-specific files
147
- */Build/Receipts/*
148
- */DerivedDataCache/*
149
- */Binaries/*-Shipping.*
150
- */Intermediate/*
151
-
152
- */Logs/*
1
+ # Here you can specify files to ignore when adding files to the depot.
2
+ #
3
+ # The syntax for P4IGNORE files is not the same as Perforce syntax.
4
+ # Instead, it is similar to that used by other versioning systems:
5
+ #
6
+ # - Files are specified in local syntax
7
+ # - a # character at the beginning of a line denotes a comment
8
+ # - a ! character at the beginning of a line excludes the file specification
9
+ # - a * wildcard matches substrings.
10
+ #
11
+ # http://stackoverflow.com/questions/18240084/how-does-perforce-ignore-file-syntax-differ-from-gitignore-syntax
12
+
13
+ /*.sln
14
+ /.p4sync.txt
15
+
16
+ # Ignore all Visual Studio temp files.
17
+ *.suo
18
+ *.opensdf
19
+ *.sdf
20
+ .patch_*
21
+
22
+ */DerivedDataCache/
23
+ **/DerivedDataCache/Boot.ddc
24
+ **/DerivedDataCache/**/*.udd
25
+
26
+ # Ignore all Intermediate and Saved directories
27
+ */Intermediate/*
28
+ */Saved/*
29
+
30
+ # Ignore UBT's configuration.xml
31
+ Engine/Programs/UnrealBuildTool/*
32
+ *.uatbuildrecord
33
+ *.tmp
34
+
35
+ # Ignore built binaries and temporary build files
36
+ */obj/*
37
+ *.csprojAssemblyReference.cache
38
+
39
+ # Ignore UBT's log output files
40
+ /Engine/Programs/UnrealBuildTool/*.txt
41
+
42
+ # Ignore Python cached files
43
+ *.pyc
44
+
45
+ # Ignore JetBrain's IDE folders
46
+ .idea/
47
+ .gradle/
48
+
49
+ # Ignore autogenerated files from HoloLens WMRInterop
50
+ /Engine/Source/ThirdParty/WindowsMixedRealityInterop/packages/*
51
+ /Engine/Source/ThirdParty/WindowsMixedRealityInterop/MixedRealityInteropHoloLens/Generated Files/*
52
+ /Engine/Source/ThirdParty/WindowsMixedRealityInterop/MixedRealityInteropHoloLens/x64/*
53
+ /Engine/Source/ThirdParty/WindowsMixedRealityInterop/MixedRealityInteropHoloLens/ARM64/*
54
+ /Engine/Source/ThirdParty/WindowsMixedRealityInterop/MixedRealityInterop/x64/*
55
+ /Engine/Source/ThirdParty/WindowsMixedRealityInterop/MixedRealityInterop/ARM64/*
56
+
57
+ Saved/
58
+ LocalBuilds/
59
+ *.csproj.*
60
+ .vs/*
61
+ .vsconfig
62
+ *.pdb
63
+ *.suo
64
+ *.opensdf
65
+ *.sdf
66
+ *.tmp
67
+ *.mdb
68
+ obj/
69
+ *.vcxproj
70
+ *.sln
71
+ *-Debug.*
72
+ FileOpenOrder/
73
+ *.xcworkspace
74
+ *.xcodeproj
75
+ ./Makefile
76
+ ./CMakeLists.txt
77
+ .ue4dependencies
78
+ Samples/*
79
+ FeaturePacks/*
80
+ Templates/*
81
+ Engine/Documentation/*
82
+
83
+ # Engine intermediates
84
+ Engine/Intermediate/*
85
+ Intermediate/
86
+
87
+ # Intermediate folders for programs should not be checked in
88
+ Engine\Programs\*\Intermediate\*
89
+
90
+ # Intermediate folders created for various C# programs
91
+ Engine\Source\Programs\*\obj\*
92
+
93
+ # Saved folders for programs should not be checked in
94
+ Engine\Programs\*\Saved\*
95
+ Engine\Programs\UnrealBuildTool\*
96
+
97
+ # Derived data cache should never be checked in
98
+ Engine/DerivedDataCache/*
99
+
100
+ # Ignore any build receipts
101
+ Engine/Build/Receipts/*
102
+
103
+ # Ignore personal workspace vars
104
+ p4config.txt
105
+
106
+ # Ignore Unix backup files
107
+ *~
108
+
109
+ # Ignore Mac desktop services store files
110
+ .DS_Store
111
+
112
+ # Ignore crash reports
113
+ crashinfo--*
114
+
115
+ # Ignore linux project files
116
+ *.user
117
+ *.pro
118
+ *.pri
119
+ *.kdev4
120
+
121
+ # Obj-C/Swift specific
122
+ *.hmap
123
+ *.ipa
124
+ *.dSYM.zip
125
+ *.dSYM
126
+
127
+ # Ignore documentation generated for C# tools
128
+ Engine/Binaries/DotNET/UnrealBuildTool.xml
129
+ Engine/Binaries/DotNET/AutomationScripts/BuildGraph.Automation.xml
130
+
131
+ # Ignore version files in the Engine/Binaries directory created by UBT
132
+ /Engine/Binaries/**/*.version
133
+
134
+ # Ignore exp files in the the Engine/Binaries directory as they aren't C/C++ source files
135
+ /Engine/Binaries/**/*.exp
136
+
137
+ # Ignore Swarm local save files
138
+ Engine/Binaries/DotNET/SwarmAgent.DeveloperOptions.xml
139
+ Engine/Binaries/DotNET/SwarmAgent.Options.xml
140
+
141
+ # Intermediary Files
142
+ *.target.xml
143
+ *.exe.config
144
+ *.exe.manifest
145
+
146
+ # Ignore project-specific files
147
+ */Build/Receipts/*
148
+ */DerivedDataCache/*
149
+ */Binaries/*-Shipping.*
150
+ */Intermediate/*
151
+
152
+ */Logs/*
@@ -1 +0,0 @@
1
- 0.9.37
@@ -1,497 +0,0 @@
1
- import sys
2
- import shutil
3
- import time
4
- import os
5
- import socket
6
- import getpass
7
- from datetime import datetime, timedelta
8
- from tabulate import tabulate
9
- import click
10
- from click import echo, secho
11
- from pathlib import Path
12
- from subprocess import call, Popen, PIPE
13
- from pprint import pprint
14
- import json
15
- from collections import defaultdict
16
- from dateutil.parser import parse
17
-
18
- my_path = Path(__file__).parent
19
- builds_file = my_path / "builds.json"
20
- cached_builds = {}
21
- xbapps_ensured = False
22
- console_ip = None
23
- temp_path = Path("c:/temp/xboxbuilds/")
24
- temp_path.mkdir(parents=True, exist_ok=True)
25
-
26
- def abort(msg):
27
- secho(msg, fg="red")
28
- sys.exit(1)
29
-
30
- def get_timestamp_from_logline(l):
31
- timestamp_string = l.split("]")[0][1:].split(":")[0]
32
- try:
33
- timestamp = datetime.strptime(timestamp_string, "%Y.%m.%d-%H.%M.%S")
34
- except Exception as e:
35
- return datetime.now()
36
- return timestamp
37
-
38
- def parse_changelists(changelists_string, config):
39
- all_builds = collect_builds()
40
- changelists = []
41
- if "," in changelists_string:
42
- changelists = changelists_string.split(",")
43
- elif "-" in changelists_string:
44
- lst = changelists_string.split("-")
45
- lst.sort()
46
-
47
- if len(lst) != 2:
48
- abort("Changelist range must be in the form [from]-[to]")
49
- first_changelist = int(lst[0])
50
- last_changelist = int(lst[1] or "999999999")
51
- for changelist, builds in all_builds.items():
52
- found_build = None
53
- if changelist >= first_changelist and changelist <= last_changelist:
54
- for b in builds:
55
- if b['configuration'].lower() == config.lower():
56
- found_build = b
57
- if found_build:
58
- changelists.append(changelist)
59
- else:
60
- changelists = [int(changelists_string)]
61
- for cl in changelists:
62
- if cl not in all_builds:
63
- abort(f"Changelist {cl} not found")
64
- if not changelists:
65
- abort(f"Did not find valid changeslists in '{changelists_string}' for config '{config}'")
66
- return changelists
67
-
68
-
69
- def collect_builds():
70
- global cached_builds
71
- if cached_builds:
72
- return cached_builds
73
- builds_path = Path("U:/SN2")
74
- builds_by_changelist = defaultdict(list)
75
- for f in builds_path.iterdir():
76
- if "_MAIN_" not in str(f):
77
- continue
78
- n = f.name
79
- lst = n.replace("CL-", "").split("_")
80
- build_number = int(lst[0])
81
- branch = lst[-2]
82
- configuration = "Test" if "test" in n.lower() else "Development"
83
- changelist = int(lst[-1])
84
- builds_by_changelist[changelist].append((f.name, branch, configuration))
85
- builds_by_changelist = dict(sorted(builds_by_changelist.items()))
86
- #pprint(builds_by_changelist)
87
- builds = get_builds()
88
- if not builds:
89
- secho("Running initial scan. This will take a while...", fg="yellow")
90
- n = 0
91
- for changelist, folders in builds_by_changelist.items():
92
- if changelist in builds:
93
- builds_by_changelist[changelist] = builds[changelist]
94
- continue
95
- if changelist not in builds:
96
- builds[changelist] = []
97
-
98
- for folder, branch, configuration in folders:
99
- path = builds_path / folder
100
- # U:\SN2\10147_TEST_MAIN_CL-53357\Publish\++project+sn2-main-ue\Subnautica2-CL-53353\XSX\Packages\Test
101
- package_path = path / "Publish" / "++project+sn2-main-ue"
102
- #print(package_path)
103
- # / f"Subnautica2-CL-{changelist}" / "XSX\Packages" / "Test"
104
- for f in package_path.glob("*/XSX/Packages/*/*.xvc"):
105
- if f.is_file():
106
- print(f"Found XBox build for {folder}")
107
- build = {
108
- "filename": f.name,
109
- "path": f.as_posix(),
110
- "configuration": configuration,
111
- "branch": branch,
112
- "size_mb": f.stat().st_size // 1024 // 1024,
113
- "timestamp": datetime.fromtimestamp(f.stat().st_mtime).isoformat(),
114
- }
115
- builds[changelist].append(build)
116
- n += 1
117
-
118
- save_builds(builds)
119
- cached_builds = builds
120
- return builds
121
-
122
- def get_loglines(num=None):
123
- ensure_xbapps()
124
- path = Path(f"//{console_ip}/RunningTitle/gdk/Drives/Scratch/Settings/Subnautica2/Saved/VideoTours/Subnautica2s.log")
125
- if not path.is_file():
126
- abort(f"Path {path} not found")
127
- with path.open('w') as f:
128
- f.write("hge")
129
- lines = f.readlines()
130
- ret = []
131
- if num:
132
- lines = lines[-num:]
133
- for l in lines:
134
- ret.append(l.strip())
135
- return ret
136
-
137
- def ensure_xbapps():
138
- global console_ip
139
- if console_ip:
140
- return
141
- game_dk = os.environ.get("GAMEDK")
142
- if not game_dk:
143
- abort("XBox GDK Manager is not installed")
144
- game_bin_path = Path(game_dk) / "bin"
145
- xbapp = game_bin_path / "xbapp.exe"
146
- xbconnect = game_bin_path / "xbconnect.exe"
147
- if not xbapp.is_file() or not xbconnect.is_file():
148
- abort("XBox GDK Manager is not installed")
149
- p = Popen(f"{xbconnect} /q /b", stdout=PIPE, stderr=PIPE)
150
- out, err = p.communicate()
151
- if not not p.returncode:
152
- abort("No XBox console found (1)")
153
-
154
- console_ip = out.strip().decode()
155
- if not console_ip.startswith("192."):
156
- abort("No XBox console found (2)")
157
-
158
- def xb(appname):
159
- ensure_xbapps()
160
- return Path(os.environ.get("GAMEDK")) / "bin" / appname
161
-
162
- def get_builds():
163
- try:
164
- with open(builds_file) as f:
165
- return {int(k): v for k, v in json.load(f).items()}
166
- except Exception as e:
167
- return {}
168
-
169
- def save_builds(data):
170
- with open(builds_file, "w") as f:
171
- json.dump(data, f, indent=4)
172
-
173
- def mount():
174
- p = Path("U:")
175
- if p.is_dir():
176
- return
177
- mountbat_filename = my_path.parent / "BatchFiles" / "MountBuildsFolder.bat"
178
- cmd = ["net", "use", "U:", r"\\sn2-storage-int.metal.subnautica.net\storage /persistent:yes /user:install belabour-hull-calcutta"]
179
- p = Popen(cmd, shell=True)
180
- stdout, stderr = p.communicate()
181
-
182
- @click.group()
183
- @click.option('--debug/--no-debug', default=False)
184
- @click.pass_context
185
- def cli(ctx, debug):
186
- """
187
- Manage xbox builds and run xbox phototours
188
- """
189
- ctx.ensure_object(dict)
190
- ctx.obj['DEBUG'] = debug
191
-
192
- @cli.command("list")
193
- @click.option("-t", "--type", "config", default="None", help="Test or Development configuration (default is both)")
194
- @click.option("-n", "--num", default=10, show_default=True, help="Maximum number of builds to show")
195
- @click.option("-d", "--days", default=7, show_default=True, help="Show builds from the last few days")
196
- @click.pass_context
197
- def list_builds(ctx, config, num, days):
198
- """
199
- List out the builds in the build folder on teamcity.
200
- This might take a while to collect the builds
201
- """
202
- mount()
203
- builds = collect_builds()
204
- hdr = ["CL", "timestamp", "config", "GB"]
205
- lst = []
206
- for changelist, builds in builds.items():
207
- for build in builds:
208
- dt = parse(build["timestamp"])
209
- if dt < datetime.now() - timedelta(days=days):
210
- continue
211
- if config and build['configuration'].lower() != config.lower():
212
- continue
213
- lst.append([changelist, dt.strftime("%Y-%m-%d %H:%M"), build['configuration'], round(build['size_mb']/1024, 1)])
214
- lst.reverse()
215
- lst = lst[:num]
216
- echo(tabulate(lst, hdr))
217
-
218
- @cli.command()
219
- @click.option("-n", "--num")
220
- @click.option("-f", "--filter")
221
- @click.pass_context
222
- def tail(ctx, num, filter):
223
- num = int(num) if num else 100
224
- lines = get_loglines(num)
225
- for l in lines:
226
- if not filter or filter.lower() in l.lower():
227
- print(l)
228
-
229
- @cli.command()
230
- @click.pass_context
231
- def kill(ctx):
232
- """
233
- Terminate the currently running executable on your xbox
234
- """
235
- ensure_xbapps()
236
- xbapp = xb("xbapp.exe")
237
- cmd = [xbapp, "terminate"]
238
- call(cmd)
239
-
240
- @cli.command()
241
- @click.option("-m", "--mode", "kit_mode", help="Set mode to xss or xsx")
242
- @click.pass_context
243
- def mode(ctx, kit_mode):
244
- """
245
- Switch the xbox console between Lockhart (series S) and Anaconda (series X) modes.
246
- This will restart the console.
247
- """
248
- ensure_xbapps()
249
- app = xb("xbconfig.exe")
250
- cmd = [app, "/D"]
251
- p = Popen(cmd, stdout=PIPE)
252
- out, err = p.communicate()
253
- curr_settings = {}
254
- for l in out.splitlines():
255
- kv = [k.strip() for k in l.strip().decode().split(":")]
256
- try:
257
- curr_settings[kv[0]] = kv[1]
258
- except Exception as e:
259
- pass
260
- console_mode = curr_settings["consolemode"]
261
- extra_title_memory = curr_settings["extratitlememory"]
262
- profiling_mode = curr_settings["profilingmode"] == "on"
263
- secho(f"Console is in mode: {console_mode}", bold=True)
264
- modes = {
265
- "xss": {
266
- "ConsoleMode": "LockhartProfiling",
267
- "ProfilingMode": "On",
268
- "ExtraTitleMemory": "6048",
269
- },
270
- "xsx": {
271
- "ConsoleMode": "AnacondaProfiling",
272
- "ProfilingMode": "On"
273
- },
274
- }
275
- if kit_mode:
276
- settings = modes.get(kit_mode)
277
- if not settings:
278
- abort(f"Mode {kit_mode} not Found. Please select one of: {','.join(modes.keys())}")
279
- if settings["ConsoleMode"] == console_mode:
280
- echo(f"Console is already in mode {kit_mode}")
281
- else:
282
- echo(f"Setting console to mode {kit_mode} ({settings['ConsoleMode']})")
283
- cmd = [app]
284
- for k, v in settings.items():
285
- cmd.append(f"{k}={v}")
286
- p = Popen(cmd, stdout=PIPE)
287
- out, err = p.communicate()
288
- secho("Rebooting console. Please wait...")
289
- call(xb("xbreboot.exe"))
290
-
291
- while 1:
292
- sys.stdout.write(".")
293
- sys.stdout.flush()
294
- cmd = [xb("xbconnect.exe"), "/q"]
295
- p = Popen(cmd, stdout=PIPE, stderr=PIPE)
296
- p.communicate()
297
- if p.returncode:
298
- time.sleep(1.0)
299
- else:
300
- break
301
- secho(f"\nConsole mode has been set to {kit_mode}", fg="green")
302
- ctx.invoke(mode)
303
- else:
304
- echo("Use '-m xss' or '-m xsx' to switch modes")
305
-
306
- def find_package(package):
307
- p = Path(package)
308
- if p.is_file():
309
- return p.as_posix()
310
- elif p.is_dir():
311
- files = []
312
- for f in p.glob("**/*.xvc"):
313
- if f.is_file():
314
- files.append(f.as_posix())
315
- if len(files) > 1:
316
- abort(f"Too many packages found: {files}")
317
- elif files:
318
- return files[0]
319
- abort(f"Package {package} not found")
320
-
321
- def find_build(cl, config):
322
- all_builds = collect_builds()
323
- cl = int(cl)
324
- for b in all_builds[cl]:
325
- if b['configuration'].lower() == (config or "").lower() or len(all_builds[cl]) == 1:
326
- build = b
327
- if not build:
328
- abort(f"Multiple builds for {cl} found. Please specify --type=development|test")
329
- return build
330
-
331
- @cli.command()
332
- @click.option("-c", "--cl", "changelists_string", help="Comma separated list of changelists or a range [from]-[to]")
333
- @click.option("-t", "--type", "config", default=None, help="Build configuration, select either Development or Test")
334
- @click.pass_context
335
- def fetch(ctx, changelists_string, config):
336
- """
337
- Fetch a build from teamcity storage to the local machine
338
- """
339
- all_builds = collect_builds()
340
- if not changelists_string:
341
- ctx.invoke(list_builds, config=config)
342
- changelists_string = input("Select a changelist to deploy: ")
343
-
344
- changelists = parse_changelists(changelists_string, config)
345
- secho(f"Downloading the following builds: {', '.join([str(c) for c in changelists])} in {config} configuration", bold=True)
346
- if (len(changelists) > 1):
347
- secho(f"This will require approximately {len(changelists)*20} GB space on your c:/ drive", fg="yellow")
348
-
349
- for i, cl in enumerate(changelists):
350
- build = find_build(cl, config)
351
-
352
- full_path = Path(build["path"])
353
- #echo(f"[{i+1}/{len(changelists)}] Downloading CL {cl} from {full_path}")
354
-
355
- target_file = temp_path / build['filename']
356
- if target_file.is_file():
357
- tz = datetime.fromtimestamp(target_file.stat().st_mtime).isoformat()
358
- if tz == build['timestamp']:
359
- secho(f"[{i+1}/{len(changelists)}] Build {target_file.name} is already in {temp_path}", fg="green")
360
- continue
361
- else:
362
- secho(f"[{i+1}/{len(changelists)}] Build {target_file.name} was found in {temp_path} but has the wrong timestamp. Will re-download", fg="yellow")
363
- secho(f"[{i+1}/{len(changelists)}] Copying file {full_path} to {temp_path}...", fg="green")
364
- path_to_copy = full_path.parent.as_posix()
365
- cmd = ["robocopy.exe", path_to_copy, temp_path, "*.xvc", "/mt:10"]
366
- p = call(cmd)
367
-
368
- @cli.command()
369
- @click.option("-c", "--cl", help="Changelist number to deploy")
370
- @click.option("-p", "--package", help=".xvc Package name or folder containing package, alternative to --cl")
371
- @click.option("-t", "--type", "config", default=None, help="Build configuration, select wither Development or Test")
372
- @click.pass_context
373
- def deploy(ctx, cl, package, config):
374
- """
375
- Deploy a build that has already been downloaded to c:/temp/xboxbuilds
376
- to your xbox console
377
- """
378
- ensure_xbapps()
379
- xbapp = xb("xbapp.exe")
380
- xbconnect = xb("xbconnect.exe")
381
-
382
- if cl:
383
- echo(f"XBox found at IP {console_ip}. Deploying CL {cl}")
384
- else:
385
- echo(f"XBox found at IP {console_ip}. Deploying package {cl}")
386
-
387
- cmd = [xbapp, "list"]
388
- p = Popen(cmd, stdout=PIPE, stderr=PIPE)
389
- out, err = p.communicate()
390
- if not not p.returncode:
391
- abort("No XBox console found")
392
- app_id = ""
393
- for l in out.split():
394
- l = l.decode()
395
- # try to find the build number
396
- if "UnknownWorldsEnter" in l and "!" not in l:
397
- installed_cl = l.strip().split(".")[-1].split("_")[0]
398
- if installed_cl:
399
- try:
400
- installed_cl = int(installed_cl)
401
- except Exception as e:
402
- installed_cl = 0
403
- if installed_cl == cl:
404
- secho(f"Changelist {cl} is already installed on xbox")
405
- return
406
- if package:
407
- file_path_string = find_package(package)
408
- else:
409
- file_path_string = temp_path / find_build(cl, config)['filename']
410
- secho(f"Installing build {file_path_string} on xbox", fg="green")
411
- cmd = [xbapp, "install", file_path_string]
412
- p = call(cmd)
413
-
414
- @cli.command()
415
- @click.option("-c", "--cl", "changelists_string", help="Comma separated or [from]-[to] list of changelists")
416
- @click.option("-p", "--package", help=".xvc Package name or folder containing package, alternative to --cl")
417
- @click.option("-t", "--type", "config", default=None, help="Development or Test configuration (required)")
418
- @click.option("-m", "--mode", "kit_mode", default="xss", show_default=True, help="Run as xss or xsx")
419
- @click.option("--teamcity/--no-teamcity", default=False, help="Run as teamcity build (sets group)")
420
- @click.option("--cameras", default="xss", help="Comma separated list of camera filters")
421
- @click.pass_context
422
- def phototour(ctx, changelists_string, package, config, kit_mode, teamcity, cameras):
423
- """
424
- Run a phototour from the selected changelists on the xbox console.
425
- Downloads the required builds to your local machine before running.
426
- Before running this use 'list' to see available builds
427
- """
428
- ensure_xbapps()
429
- ctx.invoke(mode, kit_mode=kit_mode)
430
- if not package:
431
- changelists = parse_changelists(changelists_string, config)
432
- secho(f"Running phototours on the following changelists: {','.join([str(c) for c in changelists])}")
433
- ctx.invoke(fetch, changelists_string=changelists_string, config=config)
434
- for cl in changelists:
435
- run_phototour(ctx, cl, None, config, teamcity, cameras, kit_mode)
436
- else:
437
- run_phototour(ctx, None, package, config, teamcity, cameras, kit_mode)
438
-
439
- def run_phototour(ctx, cl, package, config, teamcity, cameras, kit_mode):
440
- if cl:
441
- secho(f"Deploying and running changelist {cl}", fg="green")
442
- else:
443
- secho(f"Deploying and running package {package}", fg="green")
444
- ctx.invoke(deploy, cl=cl, package=package, config=config)
445
- xbapp = xb("xbapp.exe")
446
- # get the build ID
447
- cmd = [xbapp, "list"]
448
- p = Popen(cmd, stdout=PIPE, stderr=PIPE)
449
- out, err = p.communicate()
450
- if not not p.returncode:
451
- abort("No XBox console found")
452
- app_id = ""
453
- for l in out.split():
454
- l = l.decode()
455
- if "UnknownWorldsEnter" in l and "!" in l:
456
- app_id = l.strip()
457
- if not app_id:
458
- abort("App not found on console")
459
-
460
- computer_name = socket.gethostname()
461
- current_user = getpass.getuser()
462
- cmd = [xbapp, "launch", app_id, "-phototour",
463
- f'-perftour_runner="{computer_name}/{current_user}"',
464
- '-perftour_tags="personal"']
465
- if cameras:
466
- cmd.append(f'-perftour_cameras="{cameras}"')
467
- if teamcity:
468
- cmd.append(f'-perftour_group="{kit_mode.lower()}"')
469
- secho(f"Launching phototour with app {app_id}", fg="green")
470
- p = Popen(cmd, shell=True)
471
- out, err = p.communicate()
472
- done = False
473
- start_time = datetime.now()
474
- while 1:
475
- time.sleep(10)
476
- lines = get_loglines()
477
- lines.reverse()
478
- latest_timestamp = None
479
- for l in lines:
480
- if not latest_timestamp:
481
- latest_timestamp = get_timestamp_from_logline(l)
482
- if "phototour" in l.lower():
483
- echo(l)
484
- break
485
- if "RequestExit" in l:
486
- echo(l)
487
- done = True
488
- if latest_timestamp < datetime.now() - timedelta(minutes=2):
489
- secho(f"No loglines since {latest_timestamp.isoformat()}. Quitting", fg="yellow")
490
- done = True
491
- if done:
492
- break
493
- durr = (datetime.now() - start_time).total_seconds()
494
- secho(f"Phototour has finished running in {durr} sec", fg="green")
495
-
496
- if __name__ == "__main__":
497
- cli()
File without changes