Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 75bbcf6

Browse filesBrowse files
committed
initial sdist support
1 parent 11e478c commit 75bbcf6
Copy full SHA for 75bbcf6

File tree

Expand file treeCollapse file tree

5 files changed

+219
-163
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+219
-163
lines changed

‎.travis.yml

Copy file name to clipboardExpand all lines: .travis.yml
+133-57Lines changed: 133 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ env:
44
# pip dependencies to _test_ your project
55
- TEST_DEPENDS="numpy==1.11.1"
66
# params to bdist_wheel. used to set osx build target.
7-
- BDIST_PARAMS=""
87
- CONFIG_PATH="travis_config.sh"
98
- USE_CCACHE=1
109
- UNICODE_WIDTH=32
10+
- SDIST=0
1111

1212
# Save some time, we and setup check them out on demand instead
1313
# https://docs.travis-ci.com/user/customizing-the-build/#Git-Clone-Depth
@@ -28,6 +28,7 @@ stages:
2828

2929
jobs:
3030
fast_finish: true
31+
# Travis exclude is buggy, this seems to be the only way to disable default build
3132
exclude:
3233
- language: ruby
3334
include:
@@ -57,6 +58,40 @@ jobs:
5758
# used in OSX custom build script dealing with local bottle caching
5859
- $HOME/local_bottle_metadata
5960

61+
# source distributions
62+
- os: linux
63+
env:
64+
- SDIST=1
65+
- ENABLE_CONTRIB=0
66+
- ENABLE_HEADLESS=0
67+
python: "3.8"
68+
language: python
69+
dist: xenial
70+
- os: linux
71+
env:
72+
- SDIST=1
73+
- ENABLE_CONTRIB=0
74+
- ENABLE_HEADLESS=1
75+
python: "3.8"
76+
language: python
77+
dist: xenial
78+
- os: linux
79+
env:
80+
- SDIST=1
81+
- ENABLE_CONTRIB=1
82+
- ENABLE_HEADLESS=0
83+
python: "3.8"
84+
language: python
85+
dist: xenial
86+
- os: linux
87+
env:
88+
- SDIST=1
89+
- ENABLE_CONTRIB=1
90+
- ENABLE_HEADLESS=1
91+
python: "3.8"
92+
language: python
93+
dist: xenial
94+
6095
# default builds for MacOS
6196
#further jobs in the list will use the same stage until the next assignment
6297
- stage: final
@@ -606,56 +641,74 @@ jobs:
606641

607642
# The first line is printed in the folding header in Travis output
608643
before_install: |
609-
# Check out and prepare the source
610644
set -e
611-
# Multibuild doesn't have releases, so --depth would break eventually (see
612-
# https://superuser.com/questions/1240216/server-does-not-allow-request-for-unadvertised)
613-
git submodule update --init multibuild
614-
echo "Source multibuild/common_utils.sh"
615-
source multibuild/common_utils.sh
616-
# https://github.com/matthew-brett/multibuild/issues/116
617-
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export ARCH_FLAGS=" "; fi
618-
echo "Source multibuild/travis_steps.sh"
619-
source multibuild/travis_steps.sh
620-
# This sets -x
621-
echo "Source travis_multibuild_customize.sh"
622-
source travis_multibuild_customize.sh
623-
echo $ENABLE_CONTRIB > contrib.enabled
624-
echo $ENABLE_HEADLESS > headless.enabled
625645
626-
if [ -n "$IS_OSX" ]; then
627-
echo "homebrew"
628-
TAPS="$(brew --repository)/Library/Taps"
629-
if [ -e "$TAPS/caskroom/homebrew-cask" -a -e "$TAPS/homebrew/homebrew-cask" ]; then
630-
rm -rf "$TAPS/caskroom/homebrew-cask"
631-
fi
632-
find "$TAPS" -type d -name .git -exec \
633-
bash -xec '
634-
cd $(dirname '\''{}'\'') || echo "status: $?"
635-
git clean -fxd || echo "status: $?"
636-
sleep 1 || echo "status: $?"
637-
git status || echo "status: $?"' \; || echo "status: $?"
646+
if [ -z "$SDIST" ]; then
647+
echo "sdist build"
648+
else
649+
# Check out and prepare the source
650+
# Multibuild doesn't have releases, so --depth would break eventually (see
651+
# https://superuser.com/questions/1240216/server-does-not-allow-request-for-unadvertised)
652+
git submodule update --init multibuild
638653
639-
brew_cache_cleanup
654+
source multibuild/common_utils.sh
655+
656+
# https://github.com/matthew-brett/multibuild/issues/116
657+
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export ARCH_FLAGS=" "; fi
658+
659+
source multibuild/travis_steps.sh
660+
# This sets -x
661+
662+
source travis_multibuild_customize.sh
663+
echo $ENABLE_CONTRIB > contrib.enabled
664+
echo $ENABLE_HEADLESS > headless.enabled
665+
666+
if [ -n "$IS_OSX" ]; then
667+
echo "homebrew"
668+
TAPS="$(brew --repository)/Library/Taps"
669+
if [ -e "$TAPS/caskroom/homebrew-cask" -a -e "$TAPS/homebrew/homebrew-cask" ]; then
670+
rm -rf "$TAPS/caskroom/homebrew-cask"
671+
fi
672+
find "$TAPS" -type d -name .git -exec \
673+
bash -xec '
674+
cd $(dirname '\''{}'\'') || echo "status: $?"
675+
git clean -fxd || echo "status: $?"
676+
sleep 1 || echo "status: $?"
677+
git status || echo "status: $?"' \; || echo "status: $?"
678+
brew_cache_cleanup
679+
fi
680+
echo "end"
681+
# Not interested in travis internal scripts' output
640682
fi
641-
echo "end"
642-
# Not interested in travis internal scripts' output
683+
643684
set +x
644685
645686
install: |
646687
# Build and package
647688
set -x
648-
build_wheel $REPO_DIR $PLAT
689+
690+
if [ -z "$SDIST" ]; then
691+
python setup.py sdist
692+
else
693+
build_wheel $REPO_DIR $PLAT
694+
fi
695+
649696
set +x
650697
651698
script: |
652699
# Install and run tests
653700
set -x
654-
install_run $PLAT && rc=$? || rc=$?
701+
702+
if [ -z "$SDIST" ]; then
703+
echo "sdist"
704+
else
705+
install_run $PLAT && rc=$? || rc=$?
706+
fi
707+
655708
set +x
656709
657-
#otherwise, Travis logic terminates prematurely
658-
#https://travis-ci.community/t/shell-session-update-command-not-found-in-build-log-causes-build-to-fail-if-trap-err-is-set/817
710+
# otherwise, Travis logic terminates prematurely
711+
# https://travis-ci.community/t/shell-session-update-command-not-found-in-build-log-causes-build-to-fail-if-trap-err-is-set/817
659712
trap ERR
660713
661714
test "$rc" -eq 0
@@ -676,19 +729,11 @@ before_cache: |
676729
set +x; set +e
677730
678731
after_success: |
679-
# Upload wheels to pypi if tag is set, otherwise save to Azure Storage
680-
if [ -n "$TRAVIS_TAG" ]; then
681-
set -x
732+
# Upload wheels to pypi if tag is set
682733
683-
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
684-
pip install --user twine
685-
pip install --user --upgrade six
686-
fi
734+
set -x
687735
688-
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
689-
pip install twine
690-
pip install --upgrade pyOpenSSL
691-
fi
736+
if [ -n "$TRAVIS_TAG" ]; then
692737
693738
if [[ $ENABLE_CONTRIB == 0 ]]; then
694739
if [[ $ENABLE_HEADLESS == 0 ]]; then
@@ -704,19 +749,50 @@ after_success: |
704749
fi
705750
fi
706751
707-
twine upload -u ${USER} -p ${PASS} --skip-existing ${TRAVIS_BUILD_DIR}/wheelhouse/opencv*
708-
set +x
709-
else
710-
set -x
711-
712752
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
713-
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
714-
else
715-
brew install azure-cli
753+
pip install --user twine
754+
pip install --user --upgrade six
755+
756+
if [ -z "$SDIST" ]; then
757+
twine upload -u ${USER} -p ${PASS} --skip-existing ${TRAVIS_BUILD_DIR}/dist
758+
else
759+
twine upload -u ${USER} -p ${PASS} --skip-existing ${TRAVIS_BUILD_DIR}/wheelhouse/opencv*
760+
fi
761+
716762
fi
717763
718-
az storage container create -n ${TRAVIS_COMMIT} --public-access blob
719-
az storage blob upload-batch -d ${TRAVIS_COMMIT} -s ${TRAVIS_BUILD_DIR}/wheelhouse --pattern *.whl
764+
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
765+
# macpython 3.5 doesn't support recent TLS protocols which causes twine
766+
# upload to fail, so we use the system Python to run twine
767+
/usr/bin/python -m ensurepip --user
768+
/usr/bin/python -m pip install --user -U pip
769+
/usr/bin/python -m pip install --user -U -I twine
770+
771+
if [ -z "$SDIST" ]; then
772+
/usr/bin/python -m upload -u ${USER} -p ${PASS} --skip-existing ${TRAVIS_BUILD_DIR}/dist
773+
else
774+
/usr/bin/python -m upload -u ${USER} -p ${PASS} --skip-existing ${TRAVIS_BUILD_DIR}/wheelhouse/opencv*
775+
fi
776+
777+
fi
720778
721-
set -x
722779
fi
780+
781+
# Save to Azure storage always
782+
783+
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
784+
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
785+
else
786+
brew install azure-cli
787+
fi
788+
789+
az storage container create -n ${TRAVIS_COMMIT} --public-access blob
790+
791+
if [ -z "$SDIST" ]; then
792+
az storage blob upload-batch -d ${TRAVIS_COMMIT} -s ${TRAVIS_BUILD_DIR}/dist --pattern *.gz
793+
else
794+
az storage blob upload-batch -d ${TRAVIS_COMMIT} -s ${TRAVIS_BUILD_DIR}/wheelhouse --pattern *.whl
795+
fi
796+
797+
set +x
798+

‎MANIFEST.in

Copy file name to clipboard
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
include LICENSE-3RD-PARTY.txt
2+
include LICENSE.txt
3+
include README.md
4+
include find_version.py
5+
include setup.py
6+
recursive-include cv2 *
7+
recursive-include docker *
8+
recursive-include opencv *
9+
recursive-include opencv_contrib *
10+
recursive-include patches *

‎find_version.py

Copy file name to clipboardExpand all lines: find_version.py
+50-46Lines changed: 50 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,53 @@
22
import os
33
import subprocess
44

5-
opencv_version = ""
6-
# dig out the version from OpenCV sources
7-
version_file_path = "opencv/modules/core/include/opencv2/core/version.hpp"
8-
9-
with open(version_file_path, 'r') as f:
10-
for line in f:
11-
words = line.split()
12-
13-
if "CV_VERSION_MAJOR" in words:
14-
opencv_version += words[2]
15-
opencv_version += "."
16-
17-
if "CV_VERSION_MINOR" in words:
18-
opencv_version += words[2]
19-
opencv_version += "."
20-
21-
if "CV_VERSION_REVISION" in words:
22-
opencv_version += words[2]
23-
break
24-
25-
# used in local dev releases
26-
git_hash = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).splitlines()[0].decode()
27-
# this outputs the annotated tag if we are exactly on a tag, otherwise <tag>-<n>-g<shortened sha-1>
28-
try:
29-
tag = subprocess.check_output(['git', 'describe', '--tags'], stderr = subprocess.STDOUT).splitlines()[0].decode().split('-')
30-
except subprocess.CalledProcessError as e:
31-
# no tags reachable (e.g. on a topic branch in a fork), see
32-
# https://stackoverflow.com/questions/4916492/git-describe-fails-with-fatal-no-names-found-cannot-describe-anything
33-
if e.output.rstrip() == b"fatal: No names found, cannot describe anything.":
34-
tag=[]
35-
else:
36-
print(e.output); raise
37-
38-
if len(tag) == 1:
39-
# tag identifies the build and should be a sequential revision number
40-
version = tag[0]
41-
opencv_version += ".{}".format(version)
42-
else:
43-
# local version identifier, not to be published on PyPI
44-
version = git_hash
45-
opencv_version += "+{}".format(version)
46-
47-
print("Version: ", opencv_version)
48-
49-
with open('cv_version.py', 'w') as f:
50-
f.write('opencv_version = "{}"'.format(opencv_version))
5+
if __name__ == "__main__":
6+
contrib = sys.argv[1]
7+
headless = sys.argv[2]
8+
9+
opencv_version = ""
10+
# dig out the version from OpenCV sources
11+
version_file_path = "opencv/modules/core/include/opencv2/core/version.hpp"
12+
13+
with open(version_file_path, 'r') as f:
14+
for line in f:
15+
words = line.split()
16+
17+
if "CV_VERSION_MAJOR" in words:
18+
opencv_version += words[2]
19+
opencv_version += "."
20+
21+
if "CV_VERSION_MINOR" in words:
22+
opencv_version += words[2]
23+
opencv_version += "."
24+
25+
if "CV_VERSION_REVISION" in words:
26+
opencv_version += words[2]
27+
break
28+
29+
# used in local dev releases
30+
git_hash = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).splitlines()[0].decode()
31+
# this outputs the annotated tag if we are exactly on a tag, otherwise <tag>-<n>-g<shortened sha-1>
32+
try:
33+
tag = subprocess.check_output(['git', 'describe', '--tags'], stderr = subprocess.STDOUT).splitlines()[0].decode().split('-')
34+
except subprocess.CalledProcessError as e:
35+
# no tags reachable (e.g. on a topic branch in a fork), see
36+
# https://stackoverflow.com/questions/4916492/git-describe-fails-with-fatal-no-names-found-cannot-describe-anything
37+
if e.output.rstrip() == b"fatal: No names found, cannot describe anything.":
38+
tag=[]
39+
else:
40+
print(e.output); raise
41+
42+
if len(tag) == 1:
43+
# tag identifies the build and should be a sequential revision number
44+
version = tag[0]
45+
opencv_version += ".{}".format(version)
46+
else:
47+
# local version identifier, not to be published on PyPI
48+
version = git_hash
49+
opencv_version += "+{}".format(version)
50+
51+
with open('cv2/version.py', 'w') as f:
52+
f.write("opencv_version = \"{}\"\n".format(opencv_version))
53+
f.write("contrib = {}\n".format(contrib))
54+
f.write("headless = {}".format(headless))

‎pyproject.toml

Copy file name to clipboard
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[build-system]
2+
requires = ["setuptools", "wheel", "scikit-build", "cmake"]

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.