Skip to content

Commit

Permalink
1. for compile binaries: edit Makefile BASE
Browse files Browse the repository at this point in the history
to find boost installed by apt-get (Linux)
and homebrew (intel, Apple Silicon);
2. for newer boost versions: replace boost/filesystem/*.hpp
by boost/filesystem.hpp in source;
3. explictly check for PEP 440 compliance of version:
include packaging as build dependency,
only return compliant version from
setup.py
  • Loading branch information
rwxayheee committed Sep 7, 2024
1 parent 308e30b commit 4c20237
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 12 deletions.
2 changes: 1 addition & 1 deletion build/linux/release/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
BASE=/usr/local
BASE=/usr
BOOST_VERSION=
BOOST_INCLUDE = $(BASE)/include
C_PLATFORM=-static -pthread
Expand Down
2 changes: 1 addition & 1 deletion build/mac/release/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
BASE=/usr/local
BASE=$(shell brew --prefix)
BOOST_VERSION=
BOOST_INCLUDE = $(BASE)/include
C_PLATFORM=-pthread
Expand Down
2 changes: 1 addition & 1 deletion build/python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build-system]
requires = ["setuptools>=50.3", "wheel"]
requires = ["setuptools>=50.3", "wheel", "packaging"]
build-backend = "setuptools.build_meta"
19 changes: 16 additions & 3 deletions build/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from distutils.util import convert_path
from distutils.sysconfig import customize_compiler
from distutils.ccompiler import show_compilers

from packaging.version import Version, InvalidVersion

# Path to the directory that contains this setup.py file.
base_dir = os.path.abspath(os.path.dirname(__file__))
Expand Down Expand Up @@ -53,13 +53,25 @@ def find_version():
3. __init__.py (as failback)
"""

def is_compliant(version_str):
try:
# Attempt to parse the version string using packaging's Version class
Version(version_str)
return True
except InvalidVersion:
# If parsing fails, the version is not PEP 440 compliant
print(f"{version_str} is not PEP 440 compliant")
return False

version_file = os.path.join(base_dir, 'vina', 'version.py')
if os.path.isfile(version_file):
with open(version_file) as f:
version = f.read().strip()

print('Version found: %s (from version.py)' % version)
return version
if is_compliant(version):
return version

try:
git_output = subprocess.check_output(['git', 'describe', '--abbrev=7', '--dirty=@mod', '--always', '--tags'])
Expand All @@ -70,7 +82,8 @@ def find_version():
version = git_output.replace('-', '.dev', 1).replace('@', '-', 1).replace('-', '+', 1).replace('-','')

print('Version found %s (from git describe)' % version)
return version
if is_compliant(version):
return version
except:
pass

Expand Down
4 changes: 1 addition & 3 deletions src/lib/vina.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
#include <boost/log/trivial.hpp>
#include <boost/log/expressions.hpp>
#include <boost/program_options.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/exception.hpp>
#include <boost/filesystem/convenience.hpp> // filesystem::basename
#include <boost/filesystem.hpp>
#include <boost/thread/thread.hpp> // hardware_concurrency // FIXME rm ?
#include <boost/algorithm/string.hpp>
//#include <openbabel/mol.h>
Expand Down
4 changes: 1 addition & 3 deletions src/split/split.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
#include <fstream> // getline?
#include <cmath> // for ceila
#include <boost/program_options.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/exception.hpp>
#include <boost/filesystem/convenience.hpp> // filesystem::basename
#include <boost/filesystem.hpp>

#include "file.h"
#include "parse_error.h"
Expand Down

0 comments on commit 4c20237

Please sign in to comment.