Skip to content

Commit 3d226b0

Browse files
Make 'build' directory version specific
Adding python version and exiv2 version to the build directory is non-standard but it allows me to run a matrix of tests with different python and exiv2 versions in parallel.
1 parent 4f8cde5 commit 3d226b0

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/build
1+
/build*
22
/doc
33
/dist
44
/src/doc/api

setup.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
from setuptools import setup, Extension
1919
from setuptools import __version__ as setuptools_version
20+
import distutils.command.build
21+
import setuptools.command.egg_info
2022
import os
2123
import re
2224
import subprocess
@@ -190,7 +192,23 @@ def get_mod_src_dir(exiv2_version):
190192
extra_link_args = extra_link_args,
191193
))
192194

195+
build_arch = 'build-py{}.{}-exv{}.{}.{}'.format(
196+
*sys.version_info[:2], *exiv2_version[:3])
197+
198+
class Exiv2Build(distutils.command.build.build):
199+
def initialize_options(self):
200+
distutils.command.build.build.initialize_options(self)
201+
self.build_base = build_arch
202+
os.makedirs(self.build_base, exist_ok=True)
203+
204+
class Exiv2EggInfo(setuptools.command.egg_info.egg_info):
205+
def initialize_options(self):
206+
setuptools.command.egg_info.egg_info.initialize_options(self)
207+
self.egg_base = build_arch
208+
os.makedirs(self.egg_base, exist_ok=True)
209+
193210
setup_kwds = {
211+
'cmdclass': {'build': Exiv2Build, 'egg_info': Exiv2EggInfo},
194212
'ext_package': 'exiv2',
195213
'ext_modules': ext_modules,
196214
'packages': packages,

0 commit comments

Comments
 (0)