Skip to content

Commit

Permalink
Packaging fix: version has changed file location
Browse files Browse the repository at this point in the history
Closes #209
  • Loading branch information
sjfleming committed Apr 28, 2023
1 parent 31414be commit 0edf95a
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 13 deletions.
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
include README.rst
include VERSION
include LICENSE
include requirements.txt
include requirements-rtd.txt
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

1 change: 1 addition & 0 deletions cellbender/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '0.3.0'
17 changes: 13 additions & 4 deletions cellbender/base_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,25 @@
from abc import ABC, abstractmethod
from typing import Dict
import importlib
import codecs

# New tools should be added to this list.
TOOL_NAME_LIST = ['remove-background']


def read(rel_path):
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, rel_path), 'r') as fp:
return fp.read()


def get_version() -> str:
"""Version number is centrally located in the file called VERSION"""
with open(os.path.join(os.path.dirname(__file__), '..', 'VERSION')) as f:
version = f.read().strip()
return version
for line in read('__init__.py').splitlines():
if line.startswith('__version__'):
delim = '"' if '"' in line else "'"
return line.split(delim)[1]
else:
raise RuntimeError("Unable to find version string.")


class AbstractCLI(ABC):
Expand Down
23 changes: 16 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,25 @@

import os
import setuptools
import codecs
from typing import List


def read(rel_path):
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, rel_path), 'r') as fp:
return fp.read()


def get_version() -> str:
for line in read('cellbender/__init__.py').splitlines():
if line.startswith('__version__'):
delim = '"' if '"' in line else "'"
return line.split(delim)[1]
else:
raise RuntimeError("Unable to find version string.")


def readme() -> str:
with open('README.rst') as f:
return f.read()
Expand All @@ -28,13 +44,6 @@ def get_rtd_requirements() -> List[str]:
return requirements


def get_version() -> str:
"""Version number is centrally located in the file called VERSION"""
with open('VERSION') as f:
version = f.read().strip()
return version


setuptools.setup(
name='cellbender',
version=get_version(),
Expand Down

0 comments on commit 0edf95a

Please sign in to comment.