Skip to content

Commit 897f741

Browse files
cleaned out uneeded logic in __init__.py
1 parent 7b2043d commit 897f741

4 files changed

Lines changed: 33 additions & 247 deletions

File tree

.github/workflows/lint.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Lint with flake8
2+
on: [push]
3+
4+
concurrency:
5+
group: ${{ github.workflow }}-${{ github.ref }}
6+
cancel-in-progress: true
7+
8+
jobs:
9+
10+
lint:
11+
name: Flake8 linting
12+
runs-on: "ubuntu-latest"
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: conda-incubator/setup-miniconda@v3
16+
with:
17+
auto-update-conda: true
18+
miniforge-version: latest
19+
python-version: "3.10"
20+
conda-remove-defaults: true
21+
- name: Lint
22+
shell: bash -l {0}
23+
run: |
24+
conda install flake8
25+
# flake8 config in setup.cfg
26+
# python -m flake8 --exit-zero --statistics py_gd/
27+
python -m flake8 --statistics py_gd/

PyPI_name_transfer_request.txt

Lines changed: 0 additions & 68 deletions
This file was deleted.

build_gd.py

Lines changed: 0 additions & 154 deletions
This file was deleted.

py_gd/__init__.py

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,13 @@
1515

1616
__version__ = "2.3.3"
1717

18-
if sys.platform.startswith('win'):
19-
# This only works for Anaconda / miniconda
20-
# On other systems, logic needs to be added here.
21-
# there must be a better way to do this -- why doesn't conda take care of it?
22-
libpath = os.path.join(os.path.split(sys.executable)[0], "Library", "bin")
23-
24-
# Add lib dir to PATH:
25-
if (os.path.isfile(os.path.join(libpath, 'libpng16.dll')) and
26-
os.path.isfile(os.path.join(libpath, 'zlib.dll')) and
27-
os.path.isfile(os.path.join(libpath, 'libgd.dll'))):
28-
os.environ['PATH'] = libpath + os.pathsep + os.environ['PATH']
29-
3018
try:
3119
from .py_gd import * # noqa: F401
3220

3321
except ImportError as err:
34-
if str(err).startswith("DLL load failed:"):
35-
if not (os.path.isfile(os.path.join(libpath, 'libpng16.dll')) and
36-
os.path.isfile(os.path.join(libpath, 'zlib.dll')) and
37-
os.path.isfile(os.path.join(libpath, 'libgd.dll'))):
38-
raise RuntimeError("Can't find dlls for libgd, libpng, and libz.\n"
39-
"This kludge is only written to support Anaconda installs\n",
40-
"you may need to add some logic for other library locations",
41-
)
42-
else:
43-
raise
44-
else:
45-
raise
46-
print(err.args)
22+
raise RuntimeError("Can't find shared libs for libgd.\n"
23+
"Make sure they are installed, and on a path where they can be found.\n"
24+
"This may require some additional logic in this __init__.py,"
25+
"But it would be better to use a standard system location"
26+
) from err
27+

0 commit comments

Comments
 (0)