Skip to content

Commit 2e400b0

Browse files
authored
Add type hints, update libjpeg, allow returning bytearray (#58)
1 parent a2d5d28 commit 2e400b0

22 files changed

+2176
-2381
lines changed

.github/workflows/release-wheels.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: Store artifacts
3232
uses: actions/upload-artifact@v4
3333
with:
34-
name: wheels
34+
name: sdist
3535
path: ./dist
3636

3737
build-wheels:
@@ -184,7 +184,7 @@ jobs:
184184
- name: Store artifacts
185185
uses: actions/upload-artifact@v4
186186
with:
187-
name: wheels
187+
name: wheel-${{ matrix.python }}-${{ matrix.platform_id }}
188188
path: ./dist
189189

190190
test-package:
@@ -206,8 +206,8 @@ jobs:
206206
- name: Download the wheels
207207
uses: actions/download-artifact@v4
208208
with:
209-
name: wheels
210209
path: dist/
210+
merge-multiple: true
211211

212212
- name: Install from package wheels and test
213213
# If testing wheel builds might need --pre to install dev version

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ dist/
1414
downloads/
1515
eggs/
1616
.eggs/
17-
lib/
1817
lib64/
1918
parts/
2019
sdist/
@@ -56,7 +55,7 @@ coverage.xml
5655
*.pot
5756

5857
# Django stuff:
59-
*.log
58+
#*.log
6059
local_settings.py
6160
db.sqlite3
6261
db.sqlite3-journal

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "libjpeg/src/libjpeg"]
2-
path = libjpeg/src/libjpeg
2+
path = lib/libjpeg
33
url = https://github.com/thorfdbg/libjpeg.git

build.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99

1010

1111
PACKAGE_DIR = Path(__file__).parent / "libjpeg"
12-
LIBJPEG_SRC = PACKAGE_DIR / 'src' / 'libjpeg'
13-
INTERFACE_SRC = PACKAGE_DIR / 'src' / 'interface'
12+
LIB_DIR = Path(__file__).parent / "lib"
13+
LIBJPEG_SRC = LIB_DIR / 'libjpeg'
14+
INTERFACE_SRC = LIB_DIR / 'interface'
1415

1516

1617
def build(setup_kwargs: Any) -> Any:

libjpeg/src/interface/decode.cpp renamed to lib/interface/decode.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,13 @@
1818
#include "../libjpeg/interface/jpeg.hpp"
1919

2020

21-
std::string Decode(char *inArray, char *outArray, int inLength, int outLength, int colourTransform)
22-
{
21+
std::string Decode(
22+
char *inArray,
23+
char *outArray,
24+
int inLength,
25+
int outLength,
26+
int colourTransform
27+
) {
2328
/*
2429
2530
Parameters
@@ -254,8 +259,11 @@ std::string Decode(char *inArray, char *outArray, int inLength, int outLength, i
254259
}
255260

256261

257-
std::string GetJPEGParameters(char *inArray, int inLength, struct JPEGParameters *param)
258-
{
262+
std::string GetJPEGParameters(
263+
char *inArray,
264+
int inLength,
265+
struct JPEGParameters *param
266+
) {
259267
/*
260268
261269
Parameters

libjpeg/src/interface/decode.hpp renamed to lib/interface/decode.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818

1919
// Return the parameters of the encoded JPEG file in `inArray`
2020
extern std::string GetJPEGParameters(
21-
char *inArray, int inLength, struct JPEGParameters *param
21+
char *inArray,
22+
int inLength,
23+
struct JPEGParameters *param
2224
);
2325

2426
struct StreamData {

libjpeg/src/interface/streamhook.cpp renamed to lib/interface/streamhook.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,16 @@ JPG_LONG IStreamHook(struct JPG_Hook *hook, struct JPG_TagItem *tags)
5151
}
5252
case JPGFLAG_ACTION_WRITE:
5353
{
54-
UBYTE *buffer = (UBYTE *)tags->GetTagPtr(JPGTAG_FIO_BUFFER);
55-
ULONG size = (ULONG )tags->GetTagData(JPGTAG_FIO_SIZE);
54+
// UBYTE *buffer = (UBYTE *)tags->GetTagPtr(JPGTAG_FIO_BUFFER);
55+
// ULONG size = (ULONG )tags->GetTagData(JPGTAG_FIO_SIZE);
5656

5757
// We want to raise an error so writing can be implemented
5858
return -1;
5959
}
6060
case JPGFLAG_ACTION_SEEK:
6161
{
6262
LONG mode = tags->GetTagData(JPGTAG_FIO_SEEKMODE);
63-
LONG offset = tags->GetTagData(JPGTAG_FIO_OFFSET);
63+
// LONG offset = tags->GetTagData(JPGTAG_FIO_OFFSET);
6464

6565
// We want to raise an error here seek can be implemented
6666
switch(mode) {
File renamed without changes.
File renamed without changes.

lib/libjpeg

Submodule libjpeg added at db33a6e

0 commit comments

Comments
 (0)