pk3make 1.1.3__tar.gz → 2025.10.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.4
2
2
  Name: pk3make
3
- Version: 1.1.3
3
+ Version: 2025.10.5
4
4
  Summary: Build system for Weissblatt PK3 files
5
5
  Project-URL: Homepage, https://github.com/liquidunderground/pk3make
6
6
  Project-URL: GitHub, https://github.com/liquidunderground/pk3make
@@ -19,9 +19,21 @@ Requires-Dist: natsort
19
19
  Requires-Dist: pillow
20
20
  Description-Content-Type: text/markdown
21
21
 
22
- # PK3Make
22
+ # PK3Make - Build system for Weissblatt PK3 files
23
23
 
24
- "Make" for Weissblatt PK3 files
24
+ [PK3] is a package format for game mods based on ZIP. Although originally introduced by Quake III Arena, it has been adopted by modern source ports of Doom and by extension Weissblatt.
25
+
26
+ [PK3]: https://doomwiki.org/wiki/PK3
27
+
28
+ PK3Make lets you automatically convert Textures, Flats, FADEs, color palettes, COLORMAPs and TINTTABs into lumps for Weissblatt and package them into a tidy PK3. Additional features include:
29
+
30
+ - Deterministic PK3s - make sure that your project's PK3s are byte-for-byte reproducible
31
+ - [METAINFO]-inspired syntax with support for sprite offsets, marker definitions and Glob-based LUMPDEFs
32
+ - Bring your own PK3Makefile - Build different PK3s from the same asset tree
33
+ - Multi-threaded building
34
+ - Timestamp-based version checks - only build what's necessary as you develop
35
+
36
+ [METAINFO]: https://mtrop.github.io/DoomTools/dimgconv.html
25
37
 
26
38
  ## Installation
27
39
 
@@ -110,8 +122,15 @@ outdated files into `?workdir` during the compilation process.
110
122
 
111
123
  `?palette:` defines the main color palette, by `LUMPNAME` (`PLAYPAL` by default)
112
124
 
113
- `?destfile:` describes a filepath to the destination PK3. This is where
114
- `?workdir` will get copied to during packing.
125
+ `?destfile: <PATH>` describes a filepath to the destination PK3. This is where `?workdir` will get copied to during packing.
126
+
127
+ `?compression: <TYPE>` and `?compression_level: <INT>` define file the destination PK3's compression method and level respectively. The following compression types are supported:
128
+
129
+ 1. `none | uncompressed`: Used to create uncompressed PK3s (default)
130
+ 2. `zlib`: zlib/DEFLATE-based compression. (valid compression levels: `0...9`)
131
+ 3. `bzip2`: bzip2-based compression. (valid compression levels: `1...9`)
132
+ 4. `lzma`: LZMA compression.
133
+ 5. `zstd`: Zstandard compression (Python 3.14+; valid compression levels: `-131072...22`).
115
134
 
116
135
 
117
136
  ## Lump definitions
@@ -1,6 +1,18 @@
1
- # PK3Make
1
+ # PK3Make - Build system for Weissblatt PK3 files
2
2
 
3
- "Make" for Weissblatt PK3 files
3
+ [PK3] is a package format for game mods based on ZIP. Although originally introduced by Quake III Arena, it has been adopted by modern source ports of Doom and by extension Weissblatt.
4
+
5
+ [PK3]: https://doomwiki.org/wiki/PK3
6
+
7
+ PK3Make lets you automatically convert Textures, Flats, FADEs, color palettes, COLORMAPs and TINTTABs into lumps for Weissblatt and package them into a tidy PK3. Additional features include:
8
+
9
+ - Deterministic PK3s - make sure that your project's PK3s are byte-for-byte reproducible
10
+ - [METAINFO]-inspired syntax with support for sprite offsets, marker definitions and Glob-based LUMPDEFs
11
+ - Bring your own PK3Makefile - Build different PK3s from the same asset tree
12
+ - Multi-threaded building
13
+ - Timestamp-based version checks - only build what's necessary as you develop
14
+
15
+ [METAINFO]: https://mtrop.github.io/DoomTools/dimgconv.html
4
16
 
5
17
  ## Installation
6
18
 
@@ -89,8 +101,15 @@ outdated files into `?workdir` during the compilation process.
89
101
 
90
102
  `?palette:` defines the main color palette, by `LUMPNAME` (`PLAYPAL` by default)
91
103
 
92
- `?destfile:` describes a filepath to the destination PK3. This is where
93
- `?workdir` will get copied to during packing.
104
+ `?destfile: <PATH>` describes a filepath to the destination PK3. This is where `?workdir` will get copied to during packing.
105
+
106
+ `?compression: <TYPE>` and `?compression_level: <INT>` define file the destination PK3's compression method and level respectively. The following compression types are supported:
107
+
108
+ 1. `none | uncompressed`: Used to create uncompressed PK3s (default)
109
+ 2. `zlib`: zlib/DEFLATE-based compression. (valid compression levels: `0...9`)
110
+ 3. `bzip2`: bzip2-based compression. (valid compression levels: `1...9`)
111
+ 4. `lzma`: LZMA compression.
112
+ 5. `zstd`: Zstandard compression (Python 3.14+; valid compression levels: `-131072...22`).
94
113
 
95
114
 
96
115
  ## Lump definitions
@@ -29,6 +29,7 @@
29
29
 
30
30
  PLAYPAL palette
31
31
  PAL* palette
32
+ CREDITS.txt raw preserve_filename
32
33
  CLM0031 colormap PAL0031
33
34
  COLORMAP colormap PLAYPAL
34
35
  TRANS50 tinttab PAL0031 0.5
@@ -111,7 +111,7 @@ def build(makefile):
111
111
 
112
112
 
113
113
 
114
- for lump in natsorted(lumpglob, alg=ns.PATH):
114
+ for lump in natsorted(lumpglob, alg=ns.PATH, key=lambda x: x[1]):
115
115
  lump_dcheck = doomglob.find_lump(opts["srcdir"], lump[0])
116
116
 
117
117
  srcfile = opts["srcdir"] + '/' + lump[1]
@@ -145,7 +145,7 @@ def build(makefile):
145
145
  return
146
146
 
147
147
  def pack(makefile):
148
- from .modules import pk3zip, doomglob
148
+ from .modules import pk3zip, doomglob, pk3makefile
149
149
  from natsort import natsorted, ns
150
150
  import io, os, hashlib, pathlib, re
151
151
 
@@ -153,7 +153,10 @@ def pack(makefile):
153
153
  if opts["destfile"] == None:
154
154
  raise FileNotFoundError("destfile is not defined")
155
155
 
156
- print("# Packing")
156
+ compression = pk3makefile.Compression[opts["compression"]]
157
+ compression_level = int(opts["compression_level"])
158
+
159
+ print(f"# Packing (compression: {opts["compression"]} @ lv {opts["compression_level"]})")
157
160
 
158
161
  # Keep PK3 file in memory to avoid Windows' file access locks
159
162
  pk3buf = io.BytesIO()
@@ -169,17 +172,17 @@ def pack(makefile):
169
172
  if args.verbose:
170
173
  print(f"## Adding marker {lumpdef[0]}")
171
174
  with pk3zip.PK3File(pk3buf, "a") as pk3:
172
- pk3.writestr(lumpdef[0], "")
175
+ pk3.writestr(lumpdef[0], "", compress_type=compression, compresslevel=compression_level)
173
176
  case _:
174
177
  params = re.match(r"\s*([\w]+)\s*", lumpdef[2] or '')
175
178
  searchname = os.path.dirname(lumpdef[0])+'/'+pathlib.Path(lumpdef[0]).stem[:8]
176
179
  if params != None and "preserve_filename" in params.groups():
177
180
  searchname = lumpdef[0]
178
181
 
179
- with pk3zip.PK3File(pk3buf, "a") as pk3:
182
+ with pk3zip.PK3File(pk3buf, "a", compression=compression, compresslevel=compression_level) as pk3:
180
183
 
181
184
  wf_glob = doomglob.find_lump(opts["workdir"], searchname)
182
- wf_glob = natsorted(wf_glob, alg=ns.PATH)
185
+ wf_glob = natsorted(wf_glob, alg=ns.PATH, key=lambda x: x[1])
183
186
 
184
187
  #print(f'\nGLOB: {wf_glob}\n')
185
188
  #print(f'NAMELIST: {pk3.namelist()}\n')
@@ -201,7 +204,7 @@ def pack(makefile):
201
204
  if args.verbose:
202
205
  print(f'## Packing lump {arcpath}')
203
206
 
204
- pk3.write(wf_path, arcpath)
207
+ pk3.write(wf_path, arcpath, compress_type=compression, compresslevel=compression_level)
205
208
 
206
209
 
207
210
  # Commit in-memory PK3 file to disk
@@ -1,7 +1,6 @@
1
1
  class Palette:
2
2
  def __init__(self, filename):
3
3
  import os
4
- from modules.doomglob import find_lump, DuplicateLumpError
5
4
  from PIL import Image
6
5
 
7
6
  self.colors = []
@@ -6,6 +6,17 @@ class PK3MakeDependencyError(Exception):
6
6
  """To be raised when a lump should really be unique"""
7
7
  pass
8
8
 
9
+ import enum,zipfile
10
+
11
+ Compression = {
12
+ "none" : zipfile.ZIP_STORED,
13
+ "uncompressed" : zipfile.ZIP_STORED,
14
+ "lzma" : zipfile.ZIP_LZMA,
15
+ "bzip2" : zipfile.ZIP_BZIP2,
16
+ "zlib" : zipfile.ZIP_DEFLATED,
17
+ #zstd = zipfile.ZIP_ZSTANDARD
18
+ }
19
+
9
20
  class PK3Makefile():
10
21
  #def __init__(self):
11
22
  #pass
@@ -18,6 +29,8 @@ class PK3Makefile():
18
29
  "workdir": None,
19
30
  "destfile": None,
20
31
  "palette": None,
32
+ "compression": None,
33
+ "compression_level": None,
21
34
  }
22
35
 
23
36
  self.lumps = []
@@ -34,7 +47,7 @@ class PK3Makefile():
34
47
  tokens = re.match(re_buildopt, workline)
35
48
  if tokens: # Is it a Buildopt?
36
49
  match tokens.group(1):
37
- case "srcdir" | "workdir" | "destfile" | "palette" as cmd:
50
+ case "srcdir" | "workdir" | "destfile" | "palette" | "compression" | "compression_level" as cmd:
38
51
  self.options[cmd] = tokens.group(2).rstrip('/')
39
52
  tokens = re.match(re_lumpdef, workline)
40
53
  if tokens: # Is it a Lumpdef?
File without changes
File without changes
File without changes
File without changes