Project

General

Profile

BuildingPy3Exiv2onCentos » History » Version 2

Robin Mills, 22 Feb 2018 16:46

1 1 Robin Mills
h1. Building Exiv2 v0.26 + Python 3.6.4 + Py3Exiv2 v0.1.0 on Centos
2
3 2 Robin Mills
h2. 1) Install Development Tools on CentOS
4 1 Robin Mills
5 2 Robin Mills
h3. 1.a) Update the system and install the development tools
6
 
7
https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-local-programming-environment-on-centos-7
8
9
<pre>sudo yum -y update
10 1 Robin Mills
sudo yum -y install yum-utils
11 2 Robin Mills
sudo yum -y groupinstall development</pre>
12 1 Robin Mills
13 2 Robin Mills
h2. 2) Build and test exiv2
14 1 Robin Mills
15 2 Robin Mills
h3. 2.a) Install dependent libraries:
16 1 Robin Mills
17 2 Robin Mills
<pre>sudo yum -y install expat-devel
18
sudo yum -y install zlib-devel</pre>
19
20
h3. 2.b) Install tools required for the Exiv2 test suite
21
22
<pre>sudo yum -y install subversion
23 1 Robin Mills
sudo yum -y install dos2unix
24 2 Robin Mills
sudo yum -y install curl</pre>
25 1 Robin Mills
26 2 Robin Mills
h3. 2.c) Get the code
27
28 1 Robin Mills
http://www.exiv2.org/download.html
29
30 2 Robin Mills
h3. 2.d) Install the code into the build tree
31
32
<pre>mkdir -p ~/gnu/exiv2</pre>
33
34 1 Robin Mills
… copy the source into … ~/gnu/exiv2/exiv2-trunk
35
36 2 Robin Mills
h3. 2.e) Build it
37
38
http://dev.exiv2.org/projects/exiv2/wiki/How_do_I_build_Exiv2_on_the_XYZ_platform
39
40
<pre>cd ~/gnu/exiv2/exiv2-trunk
41 1 Robin Mills
./configure
42
make
43 2 Robin Mills
sudo make install</pre>
44 1 Robin Mills
45 2 Robin Mills
h3. 2.f) Run the test suite (optional)
46
47
<pre>export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/usr/lib/pkgconfig”
48
svn export svn://dev.exiv2.org/svn/tags/0.26/test  # once only
49 1 Robin Mills
make samples
50 2 Robin Mills
make tests</pre>
51 1 Robin Mills
52 2 Robin Mills
h2. 3) Build and install python 3.6.4
53 1 Robin Mills
54 2 Robin Mills
h3. 3.a) Get the code
55
56 1 Robin Mills
https://www.python.org/downloads/
57
58 2 Robin Mills
h3. 3.b) Install the code into the build tree
59
60
<pre>mkdir ~/gnu/python</pre>
61
62 1 Robin Mills
… copy the source into … ~/gnu/python/Python-3.6.4
63
64 2 Robin Mills
h3. 3.c) Built and install python3.6.4
65
66
<pre>cd ~/gnu/python/Python-3.6.4
67 1 Robin Mills
./configure
68
make
69 2 Robin Mills
sudo make install</pre>
70 1 Robin Mills
71 2 Robin Mills
h3. 3.d) Create a link to use python3
72 1 Robin Mills
73 2 Robin Mills
<pre>sudo ln -s /usr/local/bin/python3.6 /usr/local/bin/python3</pre>
74 1 Robin Mills
75 2 Robin Mills
h2. 4) Build and install boost
76
77
h3. 4.a) Get the code from http://www.boost.org/users/download/
78
79
<pre>mkdir ~/gnu/boost</pre>
80
81 1 Robin Mills
… copy the source into ~/gnu/boost/boost_1_66_0
82
83 2 Robin Mills
h3. 4.b) Build and install boost
84 1 Robin Mills
85 2 Robin Mills
<pre>cd ~/gnu/boost/boost_1_66_0
86
87 1 Robin Mills
export BOOST_LIBRARYDIR=$PWD/libs
88
export BOOST_ROOT=$PWD
89
export CPLUS_INCLUDE_PATH=/usr/local/include/python3.6m
90
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"
91
./bootstrap.sh --with-python=/usr/local/bin/python3.6 
92
./b2
93 2 Robin Mills
sudo $PWD/b2 install</pre>
94 1 Robin Mills
95 2 Robin Mills
h2. 5) Build and test py3exiv2
96 1 Robin Mills
97 2 Robin Mills
h3. 5.a) Get the code from https://pypi.python.org/pypi/py3exiv2/0.1.0
98
99
<pre>mkdir ~/gnu/py3exiv2</pre>
100
101 1 Robin Mills
… copy the source into ~/gnu/py3exiv2/py3exiv2-0.1.0
102
103 2 Robin Mills
h3. 5.b) Build and install py3exiv2
104 1 Robin Mills
105 2 Robin Mills
<pre>cd ~/gnu/py3exiv2/py3exiv2-0.1.0
106
sudo /usr/local/bin/python3.6 setup.py install</pre>
107
108
h3. 5.c) Test py3exiv2
109
110
<pre>curl -O http://clanmills.com/Stonehenge.jpg
111 1 Robin Mills
python3.6
112
import pyexiv2
113 2 Robin Mills
image=pyexiv2.ImageMetadata(‘Stonehenge.jpg’) # image on your computer
114 1 Robin Mills
image.read()
115
image.exif_keys
116
……….. lots and lots of lovely output …………….
117 2 Robin Mills
</pre>
118 1 Robin Mills
119
120 2 Robin Mills
h2. 6) To run in a “clean shell”
121
122
h3. 6.a) Set LD_LIBRARY_PATH
123
124 1 Robin Mills
I recommend you set this in your ~/.login or ~/.bashrc or ~/.profile so that it’s “always set"
125
126 2 Robin Mills
<pre>export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib”</pre>
127
128
h3. 6.b) Run python3
129
130
<pre>python3
131 1 Robin Mills
import pyexiv2
132 2 Robin Mills
help(pyexiv2)</pre>