Skip to content

Commit

Permalink
removes bad cmake tag in windows (#175)
Browse files Browse the repository at this point in the history
* fixes setup.py classifiers for PyPi

* updates install.md

* remove x64 tag in setup.py

* bumps (it's a bumpy day) version number
  • Loading branch information
glyg authored Jan 18, 2020
1 parent 9b728d8 commit 9fe3cf4
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 16 deletions.
11 changes: 11 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ conda install -c conda-forge tyssue

This will install tyssue and all its dependencies, with the pre-compiled binary parts.

## Install tyssue using pip

This install a cross-platform, pure python version of tyssue.
Some advanced features are not available, namely:

- Collision detection
- Periodic boundary sheet generation

```sh
python -m pip install --user --upgrade tyssue
```

## Installing from source

Expand Down
14 changes: 2 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,27 +155,17 @@ it's time to move on...

You can install the library with the conda package manager

### Linux and MacOS

```bash
conda install -c conda-forge tyssue
```

### Windows

As the tyssue library relies on the C++ CGAL library, it needs a compilation stage. This is not always simple, and conda-forge distribution might not always work.

So we provide a less feature rich `tyssue-base` package, without CGAL extensions, which is architecture independant.

```bash
conda install -c conda-forge tyssue-base
```

### Through PyPi

You can also install tyssue from PyPi, this is also CGAL-less:
You can also install tyssue from PyPi, this is a CGAL-less version (pure python), lacking some features:

`python -m pip install --user tyssue`
`python -m pip install --user --upgrade tyssue`

See [INSTALL.md](INSTALL.md) for a step by step install, including the necessary python environment.

Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
files = ["*.so*", "*.a*", "*.lib*", "config/*/*.json", "stores/*.*"]


## Version management copied form numpy
## Thanks to them!
# Version management copied form numpy
# Thanks to them!
MAJOR = 0
MINOR = 6
MICRO = 7
MICRO = 8
ISRELEASED = True
VERSION = "%d.%d.%s" % (MAJOR, MINOR, MICRO)

Expand Down Expand Up @@ -140,7 +140,7 @@ def build_extension(self, ext):
"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{}={}".format(cfg.upper(), extdir)
]
if sys.maxsize > 2 ** 32:
cmake_args += ["-A", "x64"]
cmake_args += ["-A"]
build_args += ["--", "/m"]
else:
cmake_args += ["-DCMAKE_BUILD_TYPE=" + cfg]
Expand Down
135 changes: 135 additions & 0 deletions setup_noarch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
import os
import re
import sys
import platform
import subprocess
import warnings

from distutils.version import LooseVersion
from setuptools import setup, find_packages, Extension
from setuptools.command.build_ext import build_ext


DISTNAME = "tyssue"
DESCRIPTION = "tyssue is a living tissues, cell level, modeling library"
LONG_DESCRIPTION = (
"tyssue uses the scientific python ecosystem to model"
" epithelium at the cellular level"
)
MAINTAINER = "Guillaume Gay"
MAINTAINER_EMAIL = "[email protected]"
URL = "https://github.com/DamCB/tyssue"
LICENSE = "GPL-3.0"
DOWNLOAD_URL = "https://github.com/DamCB/tyssue.git"

files = ["*.so*", "*.a*", "*.lib*", "config/*/*.json", "stores/*.*"]


## Version management copied form numpy
## Thanks to them!
MAJOR = 0
MINOR = 6
MICRO = 8
ISRELEASED = True
VERSION = "%d.%d.%s" % (MAJOR, MINOR, MICRO)


def git_version():
def _minimal_ext_cmd(cmd):
# construct minimal environment
env = {}
for k in ["SYSTEMROOT", "PATH"]:
v = os.environ.get(k)
if v is not None:
env[k] = v
# LANGUAGE is used on win32
env["LANGUAGE"] = "C"
env["LANG"] = "C"
env["LC_ALL"] = "C"
out = subprocess.Popen(cmd, stdout=subprocess.PIPE, env=env).communicate()[0]
return out

try:
out = _minimal_ext_cmd(["git", "rev-parse", "HEAD"])
GIT_REVISION = out.strip().decode("ascii")
except OSError:
GIT_REVISION = "Unknown"

return GIT_REVISION


def get_version_info():
# Adding the git rev number needs to be done inside write_version_py(),
# otherwise the import of tyssue.version messes up the build under Python 3.
FULLVERSION = VERSION
if os.path.exists(".git"):
GIT_REVISION = git_version()
elif os.path.exists("tyssue/version.py"):
# must be a source distribution, use existing version file
# read from it instead of importing to avoid importing
# the whole package
with open("tyssue/version.py", "r") as fh:
for line in fh.readlines():
if line.startswith("git_revision"):
GIT_REVISION = line.split("=")[-1][2:-2]
break
else:
GIT_REVISION = "Unknown"
else:
GIT_REVISION = "Unknown"

if not ISRELEASED:
FULLVERSION += ".dev0+" + GIT_REVISION[:7]

return FULLVERSION, GIT_REVISION


def write_version_py(filename="tyssue/version.py"):
fullversion, git_revision = get_version_info()

with open(filename, "w") as a:
a.write(
f"""
# THIS FILE IS GENERATED FROM tyssue SETUP.PY
#
short_version = '{VERSION}'
full_version = '{fullversion}'
git_revision = '{git_revision}'
release = {ISRELEASED}
if release:
version = full_version
else:
version = short_version
"""
)


write_version_py()
setup(
name=DISTNAME,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
maintainer=MAINTAINER,
maintainer_email=MAINTAINER_EMAIL,
url=URL,
license=LICENSE,
download_url=DOWNLOAD_URL,
version=VERSION,
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Natural Language :: English",
"Operating System :: MacOS",
"Operating System :: Microsoft",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Topic :: Scientific/Engineering :: Medical Science Apps.",
"Topic :: Scientific/Engineering :: Physics",
],
packages=find_packages(),
package_data={"tyssue": files},
include_package_data=True,
zip_safe=False,
)

0 comments on commit 9fe3cf4

Please sign in to comment.