Skip to content
Open
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 pseyepy/cameras.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,11 @@ class Camera():
try:
ps3eye_init()
except Exception as exc:
print exc
print(exc)
# init all cameras
count = ps3eye_count_connected()
print("pyc count: ")
print count
print(count)
self.buffers = {}
for idx,_id in enumerate(ids):
if _id >= count:
Expand Down
50 changes: 29 additions & 21 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,45 @@
from sysconfig import get_paths
import os, sys
import warnings
import platform
import subprocess

### install libusb
# keeping this slightly hacky approach to guarantee that the correct libusb is used and is easily findable
if sys.platform in ('darwin','linux','linux2'):
python_data_path = get_paths()['data']
libs = ['usb-1.0']
if '22.04' in platform.version():
subprocess.call("sudo apt install libusb-1.0-0-dev", shell=True)
libusb_incl = ['/usr/include/libusb-1.0']
libusb_libpath = '/usr/lib/x86_64-linux-gnu'
else:
# install how it worked on previous versions

wd = os.path.join('.','pseyepy','ext')
subprocess.call('tar -jxf libusb-1.0.21.tar.bz2', cwd=wd, shell=True)
python_data_path = get_paths()['data']

wd = os.path.join('.','pseyepy','ext','libusb-1.0.21')
subprocess.call('sudo ./configure --prefix={}'.format(python_data_path), cwd=wd, shell=True)
subprocess.call('make clean', cwd=wd, shell=True)
subprocess.call('sudo make', cwd=wd, shell=True)
subprocess.call('sudo make install', cwd=wd, shell=True)
wd = os.path.join('.','pseyepy','ext')
subprocess.call('tar -jxf libusb-1.0.21.tar.bz2', cwd=wd, shell=True)

wd = os.path.join('.','pseyepy','ext')
subprocess.call('mkdir -p include && mkdir -p lib', cwd=wd, shell=True)
wd = os.path.join('.','pseyepy','ext','libusb-1.0.21')
subprocess.call('sudo ./configure --prefix={}'.format(python_data_path), cwd=wd, shell=True)
subprocess.call('make clean', cwd=wd, shell=True)
subprocess.call('sudo make', cwd=wd, shell=True)
subprocess.call('sudo make install', cwd=wd, shell=True)

src_include = os.path.join(python_data_path, 'include', 'libusb-1.0')
dest_include = os.path.join('.', 'pseyepy', 'ext', 'include', 'libusb-1.0')
subprocess.call(['ln -s {} {}'.format(src_include, dest_include)], shell=True, cwd='.')
wd = os.path.join('.','pseyepy','ext')
subprocess.call('mkdir -p include && mkdir -p lib', cwd=wd, shell=True)

for ln in ['libusb-1.0.0.dylib', 'libusb-1.0.a', 'libusb-1.0.dylib', 'libusb-1.0.la']:
src_lib = os.path.join(python_data_path, 'lib', ln)
dest_lib = os.path.join('.', 'pseyepy', 'ext', 'lib', ln)
subprocess.call(['ln -s {} {}'.format(src_lib, dest_lib)], shell=True, cwd='.')
src_include = os.path.join(python_data_path, 'include', 'libusb-1.0')
dest_include = os.path.join('.', 'pseyepy', 'ext', 'include', 'libusb-1.0')
subprocess.call(['ln -s {} {}'.format(src_include, dest_include)], shell=True, cwd='.')

libusb_incl = ['pseyepy/ext/include/libusb-1.0']
libusb_libpath = 'pseyepy/ext/lib'
libs = ['usb-1.0']
for ln in ['libusb-1.0.0.dylib', 'libusb-1.0.a', 'libusb-1.0.dylib', 'libusb-1.0.la']:
src_lib = os.path.join(python_data_path, 'lib', ln)
dest_lib = os.path.join('.', 'pseyepy', 'ext', 'lib', ln)
subprocess.call(['ln -s {} {}'.format(src_lib, dest_lib)], shell=True, cwd='.')

libusb_incl = ['pseyepy/ext/include/libusb-1.0']
libusb_libpath = 'pseyepy/ext/lib'

elif sys.platform.startswith('win'):
# precompiled library from:
Expand All @@ -55,7 +63,7 @@
os.environ["CC"]= "g++"
srcs = ['pseyepy/src/ps3eye.cpp','pseyepy/src/ps3eye_capi.cpp','pseyepy/cameras.pyx']
extensions = [ Extension('pseyepy.cameras',
srcs,
srcs,
language='c++',
extra_compile_args=['-std=c++11'],
extra_link_args=['-std=c++11'],
Expand Down