Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
binary_c-python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Izzard, Robert Dr (Maths & Physics)
binary_c-python
Commits
5db28dac
Commit
5db28dac
authored
4 years ago
by
David Hendriks
Browse files
Options
Downloads
Patches
Plain Diff
updated setup, included a script that checks the version of binary_c vs the required function
parent
2b463b04
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
setup.py
+40
-15
40 additions, 15 deletions
setup.py
with
40 additions
and
15 deletions
setup.py
+
40
−
15
View file @
5db28dac
...
...
@@ -10,6 +10,29 @@ import os
import
subprocess
import
re
# Functions
def
readme
():
"""
Opens readme file and returns content
"""
with
open
(
"
README.md
"
)
as
file
:
return
file
.
read
()
def
license
():
"""
Opens license file and returns the content
"""
with
open
(
"
LICENSE.md
"
)
as
file
:
return
file
.
read
()
def
check_version
(
installed_binary_c_version
,
required_binary_c_version
):
"""
Function to check the installed version and compare it to the required version
"""
message
=
"""
The binary_c version that is installed ({}) does not match the binary_c version ({})
that this release of the binary_c python module requires.
"""
.
format
(
installed_binary_c_version
,
required_binary_c_version
)
assert
installed_binary_c_version
==
required_binary_c_version
,
message
###
REQUIRED_BINARY_C_VERSION
=
'
2.1.7
'
####
GSL_DIR
=
os
.
getenv
(
"
GSL_DIR
"
,
None
)
if
not
GSL_DIR
:
print
(
...
...
@@ -21,8 +44,6 @@ if not BINARY_C_DIR:
print
(
"
Error: the BINARY_C environment variable is not set. Aborting setup
"
)
quit
()
# TODO: write code to know exact parent directory of this file.
CWD
=
os
.
getcwd
()
...
...
@@ -33,6 +54,15 @@ CWD = os.getcwd()
# binary_c must be installed.
BINARY_C_CONFIG
=
os
.
path
.
join
(
BINARY_C_DIR
,
"
binary_c-config
"
)
BINARY_C_VERSION
=
(
subprocess
.
run
(
[
BINARY_C_CONFIG
,
"
version
"
],
stdout
=
subprocess
.
PIPE
,
check
=
True
)
.
stdout
.
decode
(
"
utf-8
"
)
.
split
()
)
check_version
(
BINARY_C_VERSION
[
0
],
REQUIRED_BINARY_C_VERSION
)
BINARY_C_INCDIRS
=
(
subprocess
.
run
(
[
BINARY_C_CONFIG
,
"
incdirs_list
"
],
stdout
=
subprocess
.
PIPE
,
check
=
True
...
...
@@ -146,17 +176,6 @@ BINARY_C_PYTHON_API_MODULE = Extension(
language
=
"
C
"
,
)
def
readme
():
"""
Opens readme file and returns content
"""
with
open
(
"
README.md
"
)
as
file
:
return
file
.
read
()
def
license
():
"""
Opens license file and returns the content
"""
with
open
(
"
LICENSE.md
"
)
as
file
:
return
file
.
read
()
############################################################
# Making the extension function
############################################################
...
...
@@ -164,8 +183,14 @@ def license():
setup
(
name
=
"
binarycpython
"
,
version
=
"
0.2
"
,
description
=
"
This is a python API for binary_c by David Hendriks, Rob Izzard and collaborators.
\
Based on the initial set up by Jeff andrews
"
,
description
=
"""
This is a python API for binary_c (version {})by David Hendriks, Rob Izzard and collaborators.
Based on the initial set up by Jeff andrews.
It is tested and designed to work for version {}, we can
'
t guarantee proper functioning for other versions
If you want to use a different version of binary_c, download and install a different version of this package
"""
.
format
(
REQUIRED_BINARY_C_VERSION
,
REQUIRED_BINARY_C_VERSION
),
author
=
"
David Hendriks, Robert Izzard and Jeff Andrews
"
,
author_email
=
"
davidhendriks93@gmail.com/d.hendriks@surrey.ac.uk,
\
r.izzard@surrey.ac.uk/rob.izzard@gmail.com andrews@physics.uoc.gr
"
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment