Skip to content

Commit 1d23c8b

Browse files
added dir of cmake reported GD dir
1 parent 49ee065 commit 1d23c8b

2 files changed

Lines changed: 84 additions & 38 deletions

File tree

.github/workflows/cibuildwheel.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
dirname $(which vcpkg)
6161
VC_PKG_DIR=$(dirname $(which vcpkg))
6262
dir $VC_PKG_DIR
63-
ls $VC_PKG_DIR
63+
dir "D:/a/py_gd/py_gd/build/vcpkg_installed/x86-windows/debug/lib/"
6464
- name: Setup deps (Windows)
6565
if: runner.os == 'Windows'
6666
run: |

README.md

Lines changed: 83 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Python wrappers for libgd graphics drawing lib.
44

55
Welcome to the `py_gd` project.
66

7-
py-gd aims to provide nice Pythonic wrappers around libgd -- a robust, fast, and simple drawing lib:
7+
py_gd aims to provide nice Pythonic wrappers around libgd -- a robust, fast, and simple drawing lib:
88

99
Docs here:
1010

@@ -27,7 +27,7 @@ If you want something fast and simple -- `py_gd` may be for you.
2727

2828
`gdmodule` (gitHub: https://github.com/Solomoriah/gdmodule) is a wrapper
2929
for gd that has been around along time. However:
30-
- It appears to be minimally maintained (last touched 9 years ago as of this writing)
30+
- It appears to be unmaintained (last touched 12 years ago as of this writing)
3131
- It is a pretty direct wrapper around the gd old-style-C API
3232
- It is hand-written C extension code -- more or less the state of the art for 1995
3333
when it was first written, but I really don't want to work on that code!
@@ -47,15 +47,19 @@ However, there is some nice stuff in gdmodule (like including a truetype font) t
4747

4848
## Dependencies:
4949

50-
`py_gd` currently requires the numpy package: http://www.numpy.org
50+
### Run Time
51+
52+
At run time, `py_gd` currently requires the numpy package: http://www.numpy.org, but nothing else.
5153

5254
numpy is used to allow you to efficiently pass in data structures for things like vertices of large polygons, etc, and can be used to get a copy of the image buffer, and manipulate it in various ways, as well as passing it back to `py_gd`.
5355

56+
### Build Time
57+
5458
In order to build `py_gd`, the Cython package is also required: http://cython.org/
5559

5660
Most critically, `py_gd` requires the `libgd` libary, which itself requires a number of other libs, such as `libpng`, `libjpeg`, etc, etc...
5761

58-
This makes it a challenge to build on any platform other than Linux. Which is why we use the conda-forge system -- it provides `lib_gd` for us.
62+
See the Install section for more info
5963

6064
## Is `py_gd` a complete wrapper around gd?
6165

@@ -68,14 +72,14 @@ Major Working features:
6872
* transparent background
6973
* built-in fonts for text
7074
* lines, polygons, arcs
71-
* experimental spline support (not in libgd itself)
75+
* cubic spline support (not in libgd itself)
7276
* copying between images
7377
* saving as gif, bmp, png, jpeg, and animated gif.
7478
* numpy arrays for input and image buffer exchange.
7579

7680
Major Missing features:
7781
* 32bit "truecolor" support
78-
* loading images from gif, png, etc...
82+
* loading images from gif, png, etc... (not hard to add, just haven't needed it)
7983
* freetype fonts
8084
* image manipulations: scaling, etc
8185

@@ -98,7 +102,7 @@ Here's what you need to do:
98102

99103
# Install
100104

101-
`py_gd` depends on libgd which, in turn, depends on libpng, and others -- this makes it a major pain to build yourself. we suggest using conda via miniconda, miniforge, or pixi, and the conda packages found in the conda-forge channel. It should be as easy as:
105+
`py_gd` depends on libgd which, in turn, depends on libpng, and others -- this makes it a major pain to build yourself. We suggest using conda via miniconda, miniforge, or pixi, and the conda packages found in the conda-forge channel. It should be as easy as:
102106

103107
```
104108
conda install -c https://conda.anaconda.org/conda-forge py_gd
@@ -108,27 +112,43 @@ This currently works on Mac, Windows and Linux
108112

109113
## pip installing
110114

111-
We try to maintain packages on PyPi, but they are only source packages -- they will need to be built to work. This is fairly straightforward on Linux, but a serious challenge on Windows and Mac. NOTE: contributions of wheels would be happily accepted.
115+
We try to maintain packages on PyPi, but they are only source packages -- they will need to be built to work. This is fairly straightforward on Linux, but a serious challenge on Windows and Mac.
116+
117+
NOTE: we are working on pre-built wheels for all major platforms -- stay tuned!
118+
119+
Contributions to the effort would be happily accepted: see:
120+
121+
https://github.com/NOAA-ORR-ERD/py_gd/issues/34
122+
123+
For progress.
112124

113125
# Building
114126

115127
## Windows
116128

117129
`py_gd` depends on libgd which, in turn, depends on libpng, and others -- this makes it a major pain to build on Windows.
118130

119-
Folks have had some luck getting it going with the newer Windows clib providers.
131+
So far, folks have had the most luck with using the vcpkg system.
132+
133+
https://vcpkg.io/en/index.html
134+
135+
`libgd` is on there, and theoretically can simply be installed::
136+
137+
vcpkg install libgd
138+
139+
Once vcpkg is setup up properly -- I am no expert on this -- let us know if it works for you, and if you needed to do anything special.
120140

121141

122142
## OS-X
123143

124-
`py_gd` depends on libgd which, in turn, depends on libpng, and others -- You can use macports or homebrew or roll your own to get these, and then the build should work.
144+
`py_gd` depends on libgd which, in turn, depends on libpng, and others -- You can use macports or homebrew or vcpkg to roll your own to get these, and then the build should work.
125145

146+
We have not tested this ourselves -- let us know what works for you.
126147

127148
## Linux
128149

129-
`py_gd` depends on libgd, which may be available in your distro's repo (it's used heavily by PHP). However your distro's version may be too old for `py_gd`, so you may have to built it yourself.
150+
`py_gd` depends on libgd, which may be available in your distro's repo (it's used heavily by PHP).
130151

131-
### building libgd
132152

133153
`py_gd` requires libgd version >= 2.3. If your Linux distro has an up to date version, you can probably simply install it (and the development headers) from the system repos. something like:
134154

@@ -137,54 +157,80 @@ apt-get install libgd, libgd-dev
137157
```
138158
or similar yum command (maybe just ``gd`` rather than ``libgd``
139159

140-
### If you dont have a recent libgd
160+
Once the library and headers are installed to "normal" locations,
161+
the py_gd build system should find them
141162

142-
If your distro doesn't have a recent version, you'll need to download the source and build it yourself.
143163

144-
(not tested recently)
145164

146-
* Download the source code from [GitHub](https://github.com/libgd/libgd/releases/)
147-
* Build the tar file from source and install it. The usual:
165+
## Building `py_gd`
148166

149-
```bash
150-
$ ./configure
151-
$ make
152-
$ make install
153-
```
167+
### get the source:
154168

155-
dance. This will install into ``/usr/local/`` if you use the defaults. If your system is not yet set up to find libraries in ``/usr/local/``, then you need to add this line to your bashrc:
169+
You can get the source:
156170

157-
```bash
158-
export LD_LIBRARY_PATH='/usr/local/lib'
159-
```
160-
(or set that globally) It needs to be set whenever you are running `py_gd`.
171+
* From PyPI:
161172

162-
Note: If you determine that you lack jpeg support -- yu should be able to install jpeg libs with your distro package mamager, e.g.
173+
* From a [release on GitHub:](https://github.com/NOAA-ORR-ERD/py_gd/releases)
163174

164-
* libjpeg-turbo-devel
165-
* libjpeg-turbo
175+
* By cloning the [`py_gd` repository](https://github.com/NOAA-ORR-ERD/py_gd) to your local machine
166176

167-
## Building `py_gd`
168177

169-
* Clone the [`py_gd` repository](https://github.com/NOAA-ORR-ERD/py_gd) to your local machine
170-
* Create a virtualenv or conda environment to scope your python installations to this project (<i>optional</i>)
178+
It's a good idea to create a venv, virtualenv or conda environment to scope your python installations to this project.
179+
180+
### Install the requirements
171181

172182
* with conda:
173183
- `conda install --file conda_requirements.txt --file conda_requirements_dev.txt`
184+
174185
* with pip:
175186
- pip install cython numpy pytest
176187

177188
* cd into the repo
178189

179-
* run these commands:
190+
### Build and Install
191+
192+
Run these commands:
180193

181194
```bash
182-
$ pip install ./
195+
$ python -m pip install .
183196
```
184197

185-
* pip install pytest and run pytest to see that everything is working:
198+
If you want to work on the source, you'll want an "editable" install:
199+
200+
```bash
201+
$ python -m pip install -e .
202+
```
203+
204+
### testing
205+
206+
The tests require pytest -- if you haven't used the conda_requirements_dev.txt, you will need to install it:
207+
208+
```bash
209+
$ python -m pip install pytest
210+
```
211+
or
212+
213+
```bash
214+
$ conda install pytest
215+
```
216+
217+
Then run the tests:
186218

187219
```bash
188220
$ pytest --pyargs py_gd
189221
```
190-
222+
223+
That will ensure the installed tests run.
224+
225+
or
226+
227+
```bash
228+
$ pytest py_gd/test
229+
```
230+
231+
That will run the tests in the source -- helpful if you want to debug or add tests.
232+
233+
The tests output a number of images -- these are checked against stored checksums for the tests.
234+
235+
But if anything doesn't match, a test may fail. You can look in `test_images_output` dir in the test dir.
236+

0 commit comments

Comments
 (0)