Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some minor improvements #2651

Merged
merged 6 commits into from
Sep 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fitz/fitz.i
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ EnsureOwnership(self)%}
#define JM_BinFromChar(x) PyBytes_FromString(x)
#define JM_BinFromCharSize(x, y) PyBytes_FromStringAndSize(x, (Py_ssize_t) y)

#include <fitz.h>
#include <pdf.h>
#include <mupdf/fitz.h>
#include <mupdf/pdf.h>
#include <time.h>
// freetype includes >> --------------------------------------------------
#include <ft2build.h>
Expand Down
56 changes: 32 additions & 24 deletions pipcl.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ def add_str(content, to_):
_log( f'Have created wheel size={st.st_size}: {path}')
with zipfile.ZipFile(path, compression=self.wheel_compression) as z:
_log(f'Contents are:')
for zi in z.infolist():
for zi in sorted(z.infolist(), key=lambda z: z.filename):
_log(f' {zi.file_size: 10d} {zi.filename}')

return os.path.basename(path)
Expand Down Expand Up @@ -767,28 +767,10 @@ def install(self, record_path=None, root=None, verbose=False):
items = list()
if self.fn_build:
items = self._call_fn_build( dict())

if root:
if windows():
# If we are in a venv, `sysconfig.get_path('platlib')`
# can be absolute, e.g.
# `C:\\...\\venv-pypackage-3.11.1-64\\Lib\\site-packages`, so
# it's not clear how to append it to `root`. So we just use
# `root`.
root2 = root
else:
# E.g. if `root` is `install' and `sysconfig.get_path('platlib')`
# is `/usr/local/lib/python3.9/site-packages`, we set `root2` to
# `install/usr/local/lib/python3.9/site-packages`.
#
r = sysconfig.get_path('platlib')
if verbose:
_log( f'{r=}')
r = r.lstrip( os.sep)
root2 = os.path.join( root, r)
else:
root2 = r
# todo: for pure-python we should use sysconfig.get_path('purelib') ?

root2 = install_dir(root)
if verbose:
_log( f'{root2=}')

_log( f'Installing into: {root2!r}')
dist_info_dir = self._dist_info_dir()
Expand Down Expand Up @@ -2090,7 +2072,33 @@ def _so_suffix():
# things like `numpy/core/_simd.cpython-311-darwin.so`.
#
return sysconfig.get_config_var('EXT_SUFFIX')



def install_dir(root=None):
'''
Returns install directory used by `install()`.

This will be `sysconfig.get_path('platlib')`, modified by `root` if not
None.
'''
# todo: for pure-python we should use sysconfig.get_path('purelib') ?
root2 = sysconfig.get_path('platlib')
if root:
if windows():
# If we are in a venv, `sysconfig.get_path('platlib')`
# can be absolute, e.g.
# `C:\\...\\venv-pypackage-3.11.1-64\\Lib\\site-packages`, so it's
# not clear how to append it to `root`. So we just use `root`.
return root
else:
# E.g. if `root` is `install' and `sysconfig.get_path('platlib')`
# is `/usr/local/lib/python3.9/site-packages`, we set `root2` to
# `install/usr/local/lib/python3.9/site-packages`.
#
return os.path.join( root, root2.lstrip( os.sep))
else:
return root2


class _Record:
'''
Expand Down
14 changes: 12 additions & 2 deletions scripts/gh_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def set_cibuild_test():
# wheel.
#
# Also, `auditwheel addtag` says `No tags to be added` and terminates
# with non-zero.
# with non-zero. See: https://github.com/pypa/auditwheel/issues/439.
#
env_set('CIBW_REPAIR_WHEEL_COMMAND_LINUX', '')
env_set('CIBW_REPAIR_WHEEL_COMMAND_MACOS', '')
Expand Down Expand Up @@ -359,7 +359,17 @@ def build_pyodide_wheel():
# Build PyMuPDF as a single wheel without a separate PyMuPDFb
# wheel.
env_extra['PYMUPDF_SETUP_IMPLEMENTATIONS'] = 'a'


# 2023-08-30: We set PYMUPDF_SETUP_MUPDF_BUILD_TESSERACT=0 because
# otherwise mupdf thirdparty/tesseract/src/ccstruct/dppoint.cpp fails to
# build because `#include "errcode.h"` finds a header inside emsdk. This is
# pyodide bug https://github.com/pyodide/pyodide/issues/3839. It's fixed in
# https://github.com/pyodide/pyodide/pull/3866 but the fix has not reached
# pypi.org's pyodide-build package. E.g. currently in tag 0.23.4, but
# current devuan pyodide-build is pyodide_build-0.23.4.
#
env_extra['PYMUPDF_SETUP_MUPDF_TESSERACT'] = '0'

command = pyodide_setup()
command += ' && pyodide build --exports pyinit'
run(command, env_extra=env_extra)
Expand Down
Loading
Loading