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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326
|
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
import os
import glob
import subprocess
from setuptools import setup, find_packages, Extension
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with open(path.join(here, 'DESCRIPTION.rst'), encoding='utf-8') as f:
long_description = f.read()
def get_libboost_name():
"""Returns the name of the lib libboost_python 3
"""
# libboost libs are provided without .pc files, so we can't use pkg-config
places = ('/usr/lib/', '/usr/local/lib/', '/usr/')
for place in places:
cmd = ['find', place, '-name', 'libboost_python*']
rep = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
if not rep:
continue
# rep is type bytes
libs = rep.decode(sys.getfilesystemencoding()).split('\n')
for l in libs:
_, l = os.path.split(l)
if '.so' in l:
l = l.split('.so')[0]
# Assume there's no longer python2.3 in the wild
if '3' in l[-2:]:
return l.replace('libboost', 'boost')
if os.name == 'nt':
basep = os.environ["VCPKG"] + r"\installed\x64-windows"
os.environ["INCLUDE"] = basep + r"\include"
libboost = basep + r"\lib\boost_python37-vc140-mt"
libexiv = basep + r"\lib\exiv2"
extra_compile_args = []
else:
libboost = get_libboost_name()
extra_compile_args = []
libexiv = 'exiv2'
setup(
name='py3exiv2',
version='0.7.0',
description='A Python3 binding to the library exiv2',
long_description=long_description,
url='https://launchpad.net/py3exiv2',
author='Vincent Vande Vyvre',
author_email='vincent.vandevyvre@oqapy.eu',
license='GPL-3',
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Topic :: Software Development',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Programming Language :: C++',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8'
],
keywords='exiv2 pyexiv2 EXIF IPTC XMP image metadata',
packages = find_packages('src'),
package_dir = {'': 'src'},
package_data={'':['src/*.cpp', 'src/*.hpp',]},
#cmdclass={'install': install}
ext_modules=[
Extension('libexiv2python',
['src/exiv2wrapper.cpp', 'src/exiv2wrapper_python.cpp'],
include_dirs=[],
library_dirs=[],
libraries=[libboost, libexiv],
extra_compile_args=extra_compile_args
)
],
)
Heres what I did:
[INSTALLING PYEXIV3 ON WINDOWS]
- install GIT-2.21.0-64-bit.exe
- install VSCodeUserSetup-x64-1.33.1.exe
- clone vcpkg, note the folder name
$ git clone https://github.com/Microsoft/vcpkg.git
- install vcpkg by running .\bootstrap-vcpkg.bat
- run vcpkg.exe install boost-python:x64-windows
- run vcpkg.exe install exiv2:x64-windows
- make sure to add /installed/x64-windows/bin to the PATH (for dll import)
- get the pyexiv2 sources from here: http://py3exiv2.tuxfamily.org/downloads
- replace setup.py with my version
- set the environment variable VCPKG to the folder where you installed it
- run pip install -e <py3exiv2-folder>
Ive attached my modified version of setup.py. Its very rough since I dont know much about setuptools at all, but it essentially involves bypassing `get_libboost_name` which fails completely on windows and using the environment variable VCPGK that has to be set by the user to point at the vcpkg directory. Theres probably a cleaner way of doing this, like accepting a command line argument. But again, I have no idea how setuptools handles this so hopefully you can clean it up a bit. `boost_python37-vc140-mt` is also completely hardcoded, youd probably have to modify `get_libboost_name` to work on Windows.
While Im at this, Ive noticed the lack of support for custom xmp tags. For now Ive resorted to abusing various IPTC Tags for my purpose, but thats a rather terrible solution. Id appreciate it if you could prioritize adding that feature in the future.
with best regards,
Vic
setup.py
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
import os
import glob
import subprocess
from setuptools import setup, find_packages, Extension
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with open(path.join(here, 'DESCRIPTION.rst'), encoding='utf-8') as f:
long_description = f.read()
def get_libboost_name():
"""Returns the name of the lib libboost_python 3
"""
# libboost libs are provided without .pc files, so we can't use pkg-config
places = ('/usr/lib/', '/usr/local/lib/', '/usr/')
for place in places:
cmd = ['find', place, '-name', 'libboost_python*']
rep = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
if not rep:
continue
# rep is type bytes
libs = rep.decode(sys.getfilesystemencoding()).split('\n')
for l in libs:
_, l = os.path.split(l)
if '.so' in l:
l = l.split('.so')[0]
# Assume there's no longer python2.3 in the wild
if '3' in l[-2:]:
return l.replace('libboost', 'boost')
if os.name == 'nt':
basep = os.environ["VCPKG"] + r"\installed\x64-windows"
os.environ["INCLUDE"] = basep + r"\include"
libboost = basep + r"\lib\boost_python37-vc140-mt"
libexiv = basep + r"\lib\exiv2"
extra_compile_args = []
else:
libboost = get_libboost_name()
extra_compile_args = []
libexiv = 'exiv2'
setup(
name='py3exiv2',
version='0.7.0',
description='A Python3 binding to the library exiv2',
long_description=long_description,
url='https://launchpad.net/py3exiv2',
author='Vincent Vande Vyvre',
author_email='vincent.vandevyvre@oqapy.eu',
license='GPL-3',
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Topic :: Software Development',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Programming Language :: C++',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8'
],
keywords='exiv2 pyexiv2 EXIF IPTC XMP image metadata',
packages = find_packages('src'),
package_dir = {'': 'src'},
package_data={'':['src/*.cpp', 'src/*.hpp',]},
#cmdclass={'install': install}
ext_modules=[
Extension('libexiv2python',
['src/exiv2wrapper.cpp', 'src/exiv2wrapper_python.cpp'],
include_dirs=[],
library_dirs=[],
libraries=[libboost, libexiv],
extra_compile_args=extra_compile_args
)
],
)
Heres what I did:
[INSTALLING PYEXIV3 ON WINDOWS]
- install GIT-2.21.0-64-bit.exe
- install VSCodeUserSetup-x64-1.33.1.exe
- clone vcpkg, note the folder name
$ git clone https://github.com/Microsoft/vcpkg.git
- install vcpkg by running .\bootstrap-vcpkg.bat
- run vcpkg.exe install boost-python:x64-windows
- run vcpkg.exe install exiv2:x64-windows
- make sure to add /installed/x64-windows/bin to the PATH (for dll import)
- get the pyexiv2 sources from here: http://py3exiv2.tuxfamily.org/downloads
- replace setup.py with my version
- set the environment variable VCPKG to the folder where you installed it
- run pip install -e <py3exiv2-folder>
Ive attached my modified version of setup.py. Its very rough since I dont know much about setuptools at all, but it essentially involves bypassing `get_libboost_name` which fails completely on windows and using the environment variable VCPGK that has to be set by the user to point at the vcpkg directory. Theres probably a cleaner way of doing this, like accepting a command line argument. But again, I have no idea how setuptools handles this so hopefully you can clean it up a bit. `boost_python37-vc140-mt` is also completely hardcoded, youd probably have to modify `get_libboost_name` to work on Windows.
While Im at this, Ive noticed the lack of support for custom xmp tags. For now Ive resorted to abusing various IPTC Tags for my purpose, but thats a rather terrible solution. Id appreciate it if you could prioritize adding that feature in the future.
with best regards,
Vic
setup.py
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
import os
import glob
import subprocess
from setuptools import setup, find_packages, Extension
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with open(path.join(here, 'DESCRIPTION.rst'), encoding='utf-8') as f:
long_description = f.read()
def get_libboost_name():
"""Returns the name of the lib libboost_python 3
"""
# libboost libs are provided without .pc files, so we can't use pkg-config
places = ('/usr/lib/', '/usr/local/lib/', '/usr/')
for place in places:
cmd = ['find', place, '-name', 'libboost_python*']
rep = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]
if not rep:
continue
# rep is type bytes
libs = rep.decode(sys.getfilesystemencoding()).split('\n')
for l in libs:
_, l = os.path.split(l)
if '.so' in l:
l = l.split('.so')[0]
# Assume there's no longer python2.3 in the wild
if '3' in l[-2:]:
return l.replace('libboost', 'boost')
if os.name == 'nt':
basep = os.environ["VCPKG"] + r"\installed\x64-windows"
os.environ["INCLUDE"] = basep + r"\include"
libboost = basep + r"\lib\boost_python37-vc140-mt"
libexiv = basep + r"\lib\exiv2"
extra_compile_args = []
else:
libboost = get_libboost_name()
extra_compile_args = []
libexiv = 'exiv2'
setup(
name='py3exiv2',
version='0.7.0',
description='A Python3 binding to the library exiv2',
long_description=long_description,
url='https://launchpad.net/py3exiv2',
author='Vincent Vande Vyvre',
author_email='vincent.vandevyvre@oqapy.eu',
license='GPL-3',
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Topic :: Software Development',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Programming Language :: C++',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8'
],
keywords='exiv2 pyexiv2 EXIF IPTC XMP image metadata',
packages = find_packages('src'),
package_dir = {'': 'src'},
package_data={'':['src/*.cpp', 'src/*.hpp',]},
#cmdclass={'install': install}
ext_modules=[
Extension('libexiv2python',
['src/exiv2wrapper.cpp', 'src/exiv2wrapper_python.cpp'],
include_dirs=[],
library_dirs=[],
libraries=[libboost, libexiv],
extra_compile_args=extra_compile_args
)
],
) |
Partager