Skip to content

Commit c4dfd40

Browse files
committed
reading package version from jamroot
1 parent 4c9ca6e commit c4dfd40

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

conanfile.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
11
from conans import (
22
ConanFile,
33
python_requires,
4+
tools,
45
)
6+
import re
57

68

79
b2 = python_requires("b2-helper/0.2.0@grisumbras/testing")
810

911

12+
def get_version():
13+
try:
14+
content = tools.load("jamroot.jam")
15+
match = re.search(r"constant\s*VERSION\s*:\s*(\S+)\s*;", content)
16+
return match.group(1)
17+
except:
18+
pass
19+
20+
1021
class EnumFlagsConan(b2.B2.Mixin, ConanFile):
1122
name = "enum-flags"
12-
version = "0.1.0"
23+
version = get_version()
1324
description = "Bit flags for C++ scoped enums"
1425
topics = "bit-mask", "bit-flag",
1526
author = "Dmitry Arkhipov <grisumbras@gmail.com>"

jamroot.jam

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import path ;
44

55
project enum-flags ;
66

7+
constant VERSION : 0.1.0 ;
8+
79

810
alias libs : usage-requirements <include>include ;
911

0 commit comments

Comments
 (0)