Skip to content

Commit 4ec6308

Browse files
committed
renamed python module
1 parent a502cee commit 4ec6308

File tree

7 files changed

+41
-19
lines changed

7 files changed

+41
-19
lines changed

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ tmp/
33
bkp/
44
build-*/
55
build_*/
6+
dist/
67
dataset_*/
78
binaries*/
89
examples/build-*/
@@ -22,6 +23,8 @@ _*
2223
*.creator.user
2324
*.files
2425
*.includes
25-
bgs.egg-info
26+
*.egg-info/
2627
.vscode/
2728
bgslibrary_gui
29+
.pypirc
30+
upload.sh

.properties

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
version=3.0.0-SNAPSHOT

CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ if(BGS_PYTHON_SUPPORT)
204204
target_compile_definitions(bgs_python PRIVATE BGS_PYTHON_SUPPORT=1)
205205

206206
# Set the output library name to bgslibrary because that's what setup.py and distutils expects.
207-
set_property(TARGET bgs_python PROPERTY OUTPUT_NAME "bgs")
207+
set_property(TARGET bgs_python PROPERTY OUTPUT_NAME "pybgs")
208208
endif()
209209

210210
#if(WIN32)
@@ -249,7 +249,7 @@ install(TARGETS bgslibrary_core
249249
RUNTIME DESTINATION bin COMPONENT app
250250
LIBRARY DESTINATION lib COMPONENT runtime
251251
ARCHIVE DESTINATION lib COMPONENT runtime
252-
PUBLIC_HEADER DESTINATION include/bgslibrary COMPONENT dev
252+
#PUBLIC_HEADER DESTINATION include/bgslibrary COMPONENT dev
253253
FRAMEWORK DESTINATION "/Library/Frameworks"
254254
)
255255

demo.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import numpy as np
22
import cv2
3-
import bgs
3+
import pybgs as bgs
44

55
algorithm = bgs.FrameDifference()
66
video_file = "dataset/video.avi"

demo2.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import numpy as np
22
import cv2
3-
import bgs
3+
import pybgs as bgs
44

55
print("OpenCV Version: {}".format(cv2.__version__))
66

setup.py

+31-13
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
To upload the binary wheel to PyPi
99
twine upload dist/*.whl
1010
To upload the source distribution to PyPi
11-
python setup.py sdist
12-
twine upload dist/bgs-*.tar.gz
11+
python setup.py sdist
12+
twine upload dist/pybgs-*.tar.gz
1313
"""
1414
import os
1515
import re
@@ -21,6 +21,19 @@
2121
from setuptools.command.build_ext import build_ext
2222
from distutils.version import LooseVersion
2323

24+
#import datetime
25+
#now = datetime.datetime.now()
26+
#
27+
#pkg_properties={}
28+
#with open('.properties') as fp:
29+
# for line in fp:
30+
# if '=' in line:
31+
# name, value = line.replace('\n','').split('=', 1)
32+
# if "SNAPSHOT" in value:
33+
# dev_version = "." + now.strftime("%y%m%d%H%M") + ".dev"
34+
# value = value.replace("-SNAPSHOT", dev_version)
35+
# pkg_properties[name] = value
36+
2437

2538
class CMakeExtension(Extension):
2639
def __init__(self, name, sourcedir=''):
@@ -38,8 +51,8 @@ def run(self):
3851

3952
if platform.system() == "Windows":
4053
cmake_version = LooseVersion(re.search(r'version\s*([\d.]+)', out.decode()).group(1))
41-
if cmake_version < '3.1.0':
42-
raise RuntimeError("CMake >= 3.1.0 is required on Windows")
54+
if cmake_version < '3.10.0':
55+
raise RuntimeError("CMake >= 3.10.0 is required on Windows")
4356

4457
for ext in self.extensions:
4558
self.build_extension(ext)
@@ -62,7 +75,7 @@ def build_extension(self, ext):
6275
build_args += ['--', '/m']
6376
else:
6477
cmake_args += ['-DCMAKE_BUILD_TYPE=' + cfg]
65-
build_args += ['--', '-j2']
78+
build_args += ['--', '-j8']
6679

6780
env = os.environ.copy()
6881
env['CXXFLAGS'] = '{} -DVERSION_INFO=\\"{}\\"'.format(env.get('CXXFLAGS', ''),
@@ -71,21 +84,26 @@ def build_extension(self, ext):
7184
os.makedirs(self.build_temp)
7285
subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env)
7386
subprocess.check_call(['cmake', '--build', '.'] + build_args, cwd=self.build_temp)
74-
#subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd="./build", env=env)
75-
#subprocess.check_call(['cmake', '--build', '.'] + build_args, cwd="./build")
87+
print()
88+
89+
with open("README.md", "r") as fh:
90+
long_description = fh.read()
7691

7792
setup(
78-
name='bgs',
79-
version='2.0.0',
93+
name='pybgs',
94+
version='3.0.0',
95+
#version=pkg_properties["version"],
8096
author='Andrews Sobral',
8197
author_email='andrewssobral@gmail.com',
8298
url='https://github.com/andrewssobral/bgslibrary',
83-
license='GPL v3',
99+
license='MIT',
84100
description='Python wrapper for bgslibrary using pybind11 and CMake',
85-
long_description='',
86-
ext_modules=[CMakeExtension('bgs')],
101+
long_description=long_description,
102+
long_description_content_type="text/markdown",
103+
ext_modules=[CMakeExtension('src')],
87104
cmdclass=dict(build_ext=CMakeBuild),
88105
zip_safe=False,
89-
packages=find_packages(),
106+
#packages=find_packages('pybgs'),
107+
#package_dir={'':'pybgs'},
90108
keywords=['BGSLibrary', 'Background Subtraction', 'Computer Vision', 'Machine Learning'],
91109
)

wrapper/python/bgslibrary_module.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ cv::Mat read_image(std::string image_name)
3131
return image;
3232
}
3333

34-
PYBIND11_MODULE(bgs, m)
34+
PYBIND11_MODULE(pybgs, m)
3535
{
3636
NDArrayConverter::init_numpy();
3737
m.doc() = "python wrapper for bgslibrary using pybind11";

0 commit comments

Comments
 (0)