Skip to content

Latest commit

 

History

History
62 lines (45 loc) · 1.57 KB

BUILD.md

File metadata and controls

62 lines (45 loc) · 1.57 KB

Building Python distributables

This section contain guides to building distributable .whl files for the purpose of distributing code on the Python Package Index (PyPI).

Linux

It is highly recommended to generate distributable files using the provided Dockerfile.posix file. This also makes its easy to build from MacOS.

Requirements:

# Building Docker image
# Run this from the root directory of this repository
docker build --rm -t opencc -f python/Dockerfile.posix .

# Mount ./dist and build `.whl` files
mkdir -p dist
docker run --rm -it -v $PWD/dist:/opt/OpenCC/dist opencc \
    bash bdist_array.bash /opt/conda/etc/profile.d/conda.sh

# It might be necessary to change the ownership of files
sudo chown -R $USER:$USER ./dist

MacOS

As there are no MacOS docker images, distributable files have to be built locally.

Requirements:

  • xcode
  • An installation of conda (miniconda or anaconda)
# Ensure that miniconda is pre-installed
# Run this from the root directory of this repository
# replacing CONDA_INSTALL_DIR
bash ./bdist_array.bash $CONDA_INSTALL_DIR/etc/profile.d/conda.sh

Windows

Requirements:

  • Microsoft Visual C++
  • CMakeTools
  • An installation of conda (miniconda or anaconda)

The requirements can be installed using Visual Studio Community Edition

# Ensure that `cmake.exe` and `conda` can all be found in your PATH
.\bdist_array.cmd