From 9563dfff47f75292a521a980d32873ea99636af7 Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Wed, 22 Feb 2023 02:37:51 +0100 Subject: [PATCH] on versions in setup.py --- setup.py | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/setup.py b/setup.py index ebe2933..20b54d6 100644 --- a/setup.py +++ b/setup.py @@ -8,25 +8,20 @@ import subprocess libname = "cnorxz" author = "Christian Zimmermann" author_email = "chizeta@f3l.de" +path_to_cnorxz = "/home/chizeta/repos/cnorxz/install" expected_cnorxz_version = "1.0.0" # dummy for now; in the future this is supposed to be the c++ version which is guaranteed to be compatible with py cnorxz git_hash = subprocess.run(['git','rev-parse','HEAD'],stdout=subprocess.PIPE).stdout.decode('ascii')[:-1] git_tags = subprocess.run(['git', 'tag', '-l', '--sort=refname', 'v*'],stdout=subprocess.PIPE).stdout.decode('ascii').split() +cnorxz_version = subprocess.run([path_to_cnorxz+"/bin/cnorxz-config",'--version'],stdout=subprocess.PIPE).stdout.decode('ascii')[:-1] -version = git_hash[:7] -if len(git_tags) != 0: - git_tag = git_tags[-1] - git_hash_tag = subprocess.run(['git','rev-parse',git_tag],stdout=subprocess.PIPE).stdout.decode('ascii')[:-1] - if git_hash_tag == git_hash: - version = git_tag[1:] - else: - version += git_tag[1:] - -# if expected_cnorxz_version != cnorxz_version -# version += '-cxz' + cnorxz_version +assert len(git_tags) != 0, "no version tags found" +git_tag = git_tags[-1] +version = git_tag[1:] + 'dev' +git_hash_tag = subprocess.run(['git','rev-parse',git_tag],stdout=subprocess.PIPE).stdout.decode('ascii')[:-1] +if git_hash_tag == git_hash and expected_cnorxz_version != cnorxz_version: + version = git_tag[1:] -path_to_cnorxz = "/home/chizeta/repos/cnorxz/install" - inc_dirs = list() if path_to_cnorxz != "": inc_dirs.append( path_to_cnorxz + "/include/cnorxz" ) @@ -39,7 +34,8 @@ if path_to_cnorxz != "": lib_dirs.append( "/home/chizeta/repos/cnorxz/install/lib" ) extra_compile_args = sysconfig.get_config_var('CFLAGS').split() -extra_compile_args += ["-std=c++17", "-Wall", "-Wextra", "-Wpedantic"] # get this automatically from cnorxz itself?? +cnorxz_flags = subprocess.run([path_to_cnorxz+"/bin/cnorxz-config",'--flags'],stdout=subprocess.PIPE).stdout.decode('ascii').split() +extra_compile_args += cnorxz_flags default_extension_args = dict( language = "c++",