diff options
| author | Jon Bernard <bernardj@gmail.com> | 2010-09-18 15:13:29 -0400 |
|---|---|---|
| committer | Jon Bernard <bernardj@gmail.com> | 2010-09-18 15:13:29 -0400 |
| commit | 5624b973b4ae39cf4985cc60055c695ee38d8150 (patch) | |
| tree | 2c41b7e9215b24534b435893e4183c190219e50e | |
| parent | 9458b75cd770e13668c13e9bbe006afd0a9c9891 (diff) | |
| download | pepseq-5624b973b4ae39cf4985cc60055c695ee38d8150.zip | |
Remove unnecessary template code
Quickly includes support for several features (eg. data directory) that
I find unnecessary for this project. Strip out all that crap and
simplify setup.py. Who wants a python application that can only build on
recent versions of Ubuntu?
| -rwxr-xr-x | bin/pepseq | 6 | ||||
| -rw-r--r-- | pepseq/__init__.py | 3 | ||||
| -rw-r--r-- | pepseq/core.py | 3 | ||||
| -rw-r--r-- | pepseq/pepseqconfig.py | 50 | ||||
| -rw-r--r-- | setup.py | 68 |
5 files changed, 21 insertions, 109 deletions
@@ -1,7 +1,6 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -import gettext import logging import optparse import os @@ -20,7 +19,7 @@ if (os.path.exists(os.path.join(PROJECT_ROOT_DIRECTORY, 'pepseq')) sys.path.insert(0, PROJECT_ROOT_DIRECTORY) os.putenv('PYTHONPATH', PROJECT_ROOT_DIRECTORY) # for subprocesses -from pepseq import pepseqconfig +from pepseq.core import __version__ LEVELS = ( logging.ERROR, logging.WARNING, @@ -30,10 +29,9 @@ LEVELS = ( logging.ERROR, if __name__ == "__main__": - version = pepseqconfig.__pepseq_data_directory__ # Support for command line options. usage = _("pepseq [options]") - parser = optparse.OptionParser(version="pepseq %s" % version, usage=usage) + parser = optparse.OptionParser(version="pepseq %s" % __version__, usage=usage) parser.add_option('-d', '--debug', dest='debug_mode', action='store_true', help=_('Print the maximum debugging info (implies -vv)')) parser.add_option('-v', '--verbose', dest='logging_level', action='count', diff --git a/pepseq/__init__.py b/pepseq/__init__.py index e69de29..282b47b 100644 --- a/pepseq/__init__.py +++ b/pepseq/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +__all__ = ['core'] diff --git a/pepseq/core.py b/pepseq/core.py new file mode 100644 index 0000000..7ef538f --- /dev/null +++ b/pepseq/core.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +__version__ = '0.0.0' diff --git a/pepseq/pepseqconfig.py b/pepseq/pepseqconfig.py deleted file mode 100644 index a4c18c6..0000000 --- a/pepseq/pepseqconfig.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- - -__all__ = [ - 'project_path_not_found', - 'get_data_file', - 'get_data_path', - ] - -# Where your project will look for your data (for instance, images and ui -# files). By default, this is ../data, relative your trunk layout -__pepseq_data_directory__ = '../data/' -__license__ = '' - -import os - -import gettext -from gettext import gettext as _ -gettext.textdomain('pepseq') - -class project_path_not_found(Exception): - """Raised when we can't find the project directory.""" - - -def get_data_file(*path_segments): - """Get the full path to a data file. - - Returns the path to a file underneath the data directory (as defined by - `get_data_path`). Equivalent to os.path.join(get_data_path(), - *path_segments). - """ - return os.path.join(get_data_path(), *path_segments) - - -def get_data_path(): - """Retrieve pepseq data path - - This path is by default <pepseq_lib_path>/../data/ in trunk - and /usr/share/pepseq in an installed version but this path - is specified at installation time. - """ - - # Get pathname absolute or relative. - path = os.path.join( - os.path.dirname(__file__), __pepseq_data_directory__) - - abs_data_path = os.path.abspath(path) - if not os.path.exists(abs_data_path): - raise project_path_not_found - - return abs_data_path @@ -1,58 +1,16 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -import os -import sys - -try: - import DistUtilsExtra.auto -except ImportError: - print >> sys.stderr, 'To build pepseq you need https://launchpad.net/python-distutils-extra' - sys.exit(1) -assert DistUtilsExtra.auto.__version__ >= '2.18', 'needs DistUtilsExtra.auto >= 2.18' - -def update_data_path(prefix, oldvalue=None): - - try: - fin = file('pepseq/pepseqconfig.py', 'r') - fout = file(fin.name + '.new', 'w') - - for line in fin: - fields = line.split(' = ') # Separate variable from value - if fields[0] == '__pepseq_data_directory__': - # update to prefix, store oldvalue - if not oldvalue: - oldvalue = fields[1] - line = "%s = '%s'\n" % (fields[0], prefix) - else: # restore oldvalue - line = "%s = %s" % (fields[0], oldvalue) - fout.write(line) - - fout.flush() - fout.close() - fin.close() - os.rename(fout.name, fin.name) - except (OSError, IOError), e: - print ("ERROR: Can't find pepseq/pepseqconfig.py") - sys.exit(1) - return oldvalue - - -class InstallAndUpdateDataDirectory(DistUtilsExtra.auto.install_auto): - def run(self): - previous_value = update_data_path(self.prefix + '/share/pepseq/') - DistUtilsExtra.auto.install_auto.run(self) - update_data_path(self.prefix, previous_value) - - - -DistUtilsExtra.auto.setup( - name='pepseq', - version='0.1', - #license='GPL-3', - #author='Your Name', - #author_email='email@ubuntu.com', - #description='UI for managing …', - #long_description='Here a longer description', - #url='https://launchpad.net/pepseq', - cmdclass={'install': InstallAndUpdateDataDirectory}) +from distutils.core import setup +from pepseq.core import __version__ + +setup(name='pepseq', + version=__version__, + description='A peptide sequencing application', + long_description=open('README.md').read(), + author='Jon Bernard', + author_email='jbernard@tuxion.com', + url='http://github.com/jbernard/pepseq', + scripts=['bin/pepseq'], + packages=['pepseq'], + license='GPL-3') |