-
-
Notifications
You must be signed in to change notification settings - Fork 743
/
virtualenv-build-test-publish.sh
60 lines (46 loc) · 1.88 KB
/
virtualenv-build-test-publish.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Remove the existing virtual environment if it exists
rm -rf bgslibrary_env
# Create a new virtual environment called bgslibrary_env using Python3
python3 -m venv bgslibrary_env
# Activate the newly created virtual environment
source bgslibrary_env/bin/activate
# Upgrade pip and install required packages numpy and OpenCV
python -m pip install --upgrade pip
python -m pip install wheel setuptools
python -m pip install numpy
python -m pip install opencv-python
# Remove any existing build directory
rm -rf build/*
# Build and install the package using the setup.py script
python setup.py build
python setup.py install
# Set the PYTHONPATH environment variable to the build directory to access the installed library
# The following line is for Linux
# ubuntu 20
export PYTHONPATH=$PYTHONPATH:$PWD/build/lib.linux-x86_64-cpython-38
# ubuntu 22
export PYTHONPATH=$PYTHONPATH:$PWD/build/lib.linux-x86_64-cpython-310
# ubuntu 24
export PYTHONPATH=$PYTHONPATH:$PWD/build/lib.linux-x86_64-cpython-312
# The following line is for Mac (intel)
export PYTHONPATH=$PYTHONPATH:$PWD/build/lib.macosx-11-x86_64-cpython-39
# The following line is for Mac (arm64)
export PYTHONPATH=$PYTHONPATH:$PWD/build/lib.macosx-13-arm64-cpython-39
# Run demo.py and demo2.py to verify the package installation
python demo.py
python demo2.py
# Install the Twine package for uploading the distribution packages
python -m pip install twine
# Remove any existing build directory
rm -rf build/*
# Build a Wheel distribution package for the project
python setup.py bdist_wheel
# Upload any generated Wheel distribution packages using Twine
twine upload dist/*.whl
# Remove any existing dist directory
rm -rf dist/*
# Create a source distribution package for the project
python setup.py sdist
# Upload the generated source distribution package using Twine
twine upload --repository testpypi dist/pybgs-*.tar.gz
twine upload dist/pybgs-*.tar.gz