unknown-cli 0.5.3__tar.gz → 0.5.5__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unknown-cli
3
- Version: 0.5.3
3
+ Version: 0.5.5
4
4
  Summary: Unknown Commandline Tool
5
5
  Home-page: UNKNOWN
6
6
  Author:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unknown-cli
3
- Version: 0.5.3
3
+ Version: 0.5.5
4
4
  Summary: Unknown Commandline Tool
5
5
  Home-page: UNKNOWN
6
6
  Author:
@@ -0,0 +1 @@
1
+ 0.5.5
@@ -19,7 +19,10 @@ app = Typer()
19
19
 
20
20
  hostname = socket.gethostname().lower()
21
21
  SUBST_DRIVE = "S:"
22
- STREAMS = ["//project/sn2-main", "//project/sandbox"]
22
+ STREAMS = {
23
+ "sn2-main": "//project/sn2-main-ue",
24
+ "sandbox" : "//project/sandbox"
25
+ }
23
26
  is_windows = (os.name == 'nt')
24
27
  DEFAULT_FOLDER = "C:\Work" if is_windows else "~/Work"
25
28
  MIN_FREE_GB = 200
@@ -58,10 +61,14 @@ def get_sync_stats(p4, force=False):
58
61
  return ret
59
62
 
60
63
  @app.command()
61
- def setup(perforce_path: str = Option(DEFAULT_FOLDER, prompt="Folder to keep your workspace"), force: bool = Option(False)):
64
+ def setup(perforce_path: str = Option(DEFAULT_FOLDER, prompt="Folder to keep your workspace"), force: bool = Option(False, help="Forcefully overwrite an existing setup")):
62
65
  """
63
66
  Creates the virtual drive and perforce workspaces from
64
67
  //Project/[stream] -> s:/[stream]
68
+
69
+ Perforce Setup: https://www.notion.so/unknownworlds/How-To-Version-Control-Setup-0fc38f99d29a4558ac32b24bdfc6904f
70
+
71
+ Unreal Game Sync: https://www.notion.so/unknownworlds/How-To-Setup-Unreal-Game-Sync-59cc3348cdde449d8fdc7f39ee60c8b3
65
72
  """
66
73
  p4 = P4()
67
74
  if not p4.port or p4.port == "perforce:1666" or force:
@@ -106,15 +113,19 @@ def setup(perforce_path: str = Option(DEFAULT_FOLDER, prompt="Folder to keep you
106
113
  _, _, free = shutil.disk_usage(perforce_path.drive)
107
114
  free_gb = free // 1024 // 1024 // 1024
108
115
  if free_gb < MIN_FREE_GB:
109
- abort(f"You need to have at least {MIN_FREE_GB} GB free disk space but you have only {free_gb} GB on drive {perforce_path.drive}")
116
+ secho(f"You need to have at least {MIN_FREE_GB} GB free disk space but you have only {free_gb} GB on drive {perforce_path.drive}", fg="yellow")
117
+ y = confirm("Are you sure you want to continue?")
118
+ if not y:
119
+ abort("Aborted")
110
120
 
111
121
  config_filename = "p4config.txt"
112
122
 
113
- ignore_path = Path("~").expanduser() / ".p4ignore.txt"
114
- echo(f"Saving "+str(ignore_path))
115
- with ignore_path.open("w") as f:
116
- ignore_contents = get_datafile(".p4ignore.txt")
117
- f.write(ignore_contents)
123
+ # ignore_path = Path("~").expanduser() / ".p4ignore.txt"
124
+ # echo(f"Saving "+str(ignore_path))
125
+ # with ignore_path.open("w") as f:
126
+ # ignore_contents = get_datafile(".p4ignore.txt")
127
+ # f.write(ignore_contents)
128
+ ignore_file = "s:\\sn2-main\\.p4ignore.txt".lower()
118
129
 
119
130
  echo(f"Saving {config_filename}")
120
131
  config_file = Path("~").expanduser() / config_filename
@@ -125,7 +136,7 @@ def setup(perforce_path: str = Option(DEFAULT_FOLDER, prompt="Folder to keep you
125
136
 
126
137
  contents["P4PORT"] = p4.port
127
138
  contents["P4USER"] = p4.user
128
- contents["P4IGNORE"] = str(ignore_path)
139
+ contents["P4IGNORE"] = str(ignore_file)
129
140
 
130
141
  with config_file.open("w") as f:
131
142
  for k, v in contents.items():
@@ -171,8 +182,7 @@ def setup(perforce_path: str = Option(DEFAULT_FOLDER, prompt="Folder to keep you
171
182
  computer_name = prompt("What would you like to call this computer in Perforce (work, home, laptop, etc)", default="work")
172
183
  if not computer_name.isalpha() or computer_name != computer_name.lower():
173
184
  abort("Computer name must be lowercase with no symbols")
174
- for stream in STREAMS:
175
- stream_name = stream.split("/")[-1]
185
+ for stream_name, stream in STREAMS.items():
176
186
  mapping = f"{root_path}/{stream_name}"
177
187
  found = False
178
188
  for r in all_client_specs:
@@ -199,7 +209,10 @@ def setup(perforce_path: str = Option(DEFAULT_FOLDER, prompt="Folder to keep you
199
209
  p = Path(mapping)
200
210
  p.mkdir(parents=True, exist_ok=True)
201
211
 
202
- sync_workspaces()
212
+
213
+ secho("\nProject setup has been completed. Please sync your workspaces through p4v", fg="green")
214
+ secho("Unreal Game Sync documentation: https://www.notion.so/unknownworlds/How-To-Setup-Unreal-Game-Sync-59cc3348cdde449d8fdc7f39ee60c8b3")
215
+ #sync_workspaces()
203
216
 
204
217
  @app.command()
205
218
  def sync(stream: str = Option(""), force: bool = Option(False)):
@@ -219,13 +232,13 @@ def sync_workspaces(stream="", force=False):
219
232
  specs = get_clientspecs(p4)
220
233
  stream = stream.lower()
221
234
 
222
- for s in STREAMS:
223
- if stream in s and s not in specs:
224
- abort(f"Stream {s} has no workspace. Please run init")
235
+ for stream_name, stream in STREAMS.items():
236
+ if stream in stream and stream not in specs:
237
+ abort(f"Stream {stream} has no workspace. Please run init")
225
238
 
226
239
  if not stream:
227
240
  options = style("Available streams:\n", bold=True)
228
- for i, s in enumerate(STREAMS, 1):
241
+ for i, s in enumerate(STREAMS.values(), 1):
229
242
  folder = specs[s.lower()]["Root"]
230
243
  options += f" {i}: {s} -> {folder}\n"
231
244
  options += f" 0: ALL\n"
@@ -233,7 +246,7 @@ def sync_workspaces(stream="", force=False):
233
246
  ret = prompt(options)
234
247
  if ret.isnumeric():
235
248
  ret = int(ret)
236
- for i, s in enumerate(STREAMS, 1):
249
+ for i, s in enumerate(STREAMS.values(), 1):
237
250
  if ret == i:
238
251
  stream = s
239
252
  break
@@ -243,7 +256,7 @@ def sync_workspaces(stream="", force=False):
243
256
  else:
244
257
  abort("No stream selected")
245
258
 
246
- for s in STREAMS:
259
+ for stream_name, s in STREAMS.items():
247
260
  if stream not in s:
248
261
  continue
249
262
  folder = specs[s.lower()]["Root"]
@@ -243,6 +243,8 @@ def check_p4config():
243
243
  ignore_file = "s:\\sn2-main\\.p4ignore.txt".lower()
244
244
  p4_port = "ssl:perforce.reginald.cloud:1666"
245
245
  cfg = Path(p4.env('P4CONFIG'))
246
+ if p4.ignore_file == "unset":
247
+ return
246
248
  if p4.ignore_file.lower() != ignore_file:
247
249
  secho(f"Your p4ignore file should be set to '{ignore_file}', not '{p4.ignore_file}'.", fg="yellow")
248
250
  y = confirm(f"Would you like to change the setting in your {cfg} file?")
@@ -286,4 +288,4 @@ def check_p4config():
286
288
  exit(0)
287
289
 
288
290
  except Exception as e:
289
- raise
291
+ pass
@@ -1 +0,0 @@
1
- 0.5.3
File without changes
File without changes
File without changes