Skip to content

Commit d55a96e

Browse files
committed
Handle case where building from git checkout (fixes #20).
1 parent 02ee2b3 commit d55a96e

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

setup.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
class UnsupportedPlatformWarning(Warning):
4040
pass
4141

42+
version = get_git_version()
43+
if isinstance(version, unicode):
44+
version = version.encode('utf-8')
45+
4246
# set this to any true value to enable multithreaded compression
4347
ENABLE_MULTITHREADING = True
4448

@@ -97,7 +101,7 @@ def build_extension(self, ext):
97101
log.info('adding support for multithreaded compression')
98102
ext.define_macros.append(('COMPRESS_MF_MT', 1))
99103
ext.sources += ('src/sdk/LzFindMt.c', 'src/sdk/Threads.c', )
100-
104+
101105
if isinstance(self.compiler, MSVCCompiler):
102106
# set flags only available when using MSVC
103107
ext.extra_link_args.append('/MANIFEST')
@@ -107,7 +111,7 @@ def build_extension(self, ext):
107111
ext.extra_link_args.append('/DEBUG')
108112
else:
109113
ext.extra_compile_args.append('/MT')
110-
114+
111115
_build_ext.build_extension(self, ext)
112116

113117
descr = "Python bindings for the LZMA library by Igor Pavlov."
@@ -141,7 +145,7 @@ def build_extension(self, ext):
141145

142146
setup(
143147
name = "pylzma",
144-
version = get_git_version().decode('utf-8'),
148+
version = version,
145149
description = descr,
146150
author = "Joachim Bauch",
147151
author_email = "[email protected]",

version.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,8 @@ def get_git_version(abbrev=4):
9090

9191
if version is None:
9292
version = release_version
93-
94-
# If we still don't have anything, that's an error.
95-
96-
if version is None:
97-
raise ValueError("Cannot find the version number!")
93+
if version is None:
94+
return None
9895

9996
# If the current version is different from what's in the
10097
# RELEASE-VERSION file, update the file to be current.

0 commit comments

Comments
 (0)