Skip to content

Commit

Permalink
Merge pull request #27 from pcubillos/installing
Browse files Browse the repository at this point in the history
Installing
  • Loading branch information
pcubillos authored Jan 11, 2019
2 parents 4357ea2 + fa54764 commit e7335d7
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 9 deletions.
30 changes: 30 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -759,5 +759,35 @@ Fixed error message in am.add_bibtex() for invalid ADS token.

Bumped bibmanager version to 0.5.5.


***** Fr 11. Jan 16:11:43 CET 2019 *****

Changed ROOT (again) to point to location of bibmanager/__init__.py
(Will need to update in utils.py once I set the package structure).
PS: This commit breaks untill I fix setup.py

*****

Updated setup.py to add package_data, automate packages, and comment
out cmdclass (until I get it working).
Moved examples folder into bibmanager folder (so it can be included
during install).

*****

Restored cmdclass in setup.py. Install works as expected.

*****

Fixed bug in u.repr_author(), missed the f before the f-string.

*****

Added MANIFEST.in file.

*****

Bumped bibmanager version to 0.5.6.

*****

4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include MANIFEST.in
include CHANGELOG.txt
include README.md
include LICENSE
2 changes: 1 addition & 1 deletion bibmanager/VERSION.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# bibmanager Version:
BM_VER = 0 # Major version
BM_MIN = 5 # Minor version
BM_REV = 5 # Revision
BM_REV = 6 # Revision
6 changes: 3 additions & 3 deletions bibmanager/bib_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
from pygments.token import Token
from pygments.lexers.bibtex import BibTeXLexer

ROOT = os.path.realpath(os.path.dirname(__file__) +'/..') + '/'
sys.path.append(ROOT + 'bibmanager')
ROOT = os.path.realpath(os.path.dirname(__file__)) + '/'
sys.path.append(ROOT)
import config_manager as cm
from utils import HOME, BM_DATABASE, BM_BIBFILE, BM_TMP_BIB, BANNER, \
Sort_author, ordinal, count, cond_split, parse_name, \
Expand Down Expand Up @@ -663,7 +663,7 @@ def init(bibfile=BM_BIBFILE, reset_db=True, reset_config=False):

# Make sure config exists before working with the database:
if reset_config:
shutil.copy(ROOT+'bibmanager/config', HOME+'config')
shutil.copy(ROOT+'config', HOME+'config')
else:
cm.update_keys()

Expand Down
2 changes: 1 addition & 1 deletion bibmanager/config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def display(key=None):
def update_keys():
"""Update config in HOME with keys from ROOT, without overwriting values."""
config_root = configparser.ConfigParser()
config_root.read(ROOT+'bibmanager/config')
config_root.read(ROOT+'config')
# Wont complain if HOME+'config' does not exist (keep ROOT values):
config_root.read(HOME+'config')
with open(HOME+'config', 'w') as configfile:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions bibmanager/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

# Directories/files:
HOME = os.path.expanduser("~") + "/.bibmanager/"
ROOT = os.path.realpath(os.path.dirname(__file__) +'/..') + '/'
ROOT = os.path.realpath(os.path.dirname(__file__)) + '/'

BM_DATABASE = HOME + "bm_database.pickle"
BM_BIBFILE = HOME + "bm_bibliography.bib"
Expand Down Expand Up @@ -403,9 +403,9 @@ def repr_author(Author):
if Author.von != "":
name = " ".join([Author.von, name])
if Author.jr != "":
name += ", {Author.jr}"
name += f", {Author.jr}"
if Author.first != "":
name += ", {Author.first}"
name += f", {Author.first}"
return name


Expand Down
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# bibmanager is open-source software under the MIT license (see LICENSE).

import os
import setuptools
from setuptools import setup
from setuptools.command.develop import develop
from setuptools.command.install import install
Expand All @@ -14,13 +15,15 @@
class Init_Bibmanager_Develop(develop):
"""Script to execute after 'python setup.py develop' call."""
def run(self):
develop.run(self)
with ignored(OSError):
bm.init()


class Init_Bibmanager_Install(install):
"""Script to execute after 'python setup.py install' call."""
def run(self):
install.run(self)
with ignored(OSError):
bm.init()

Expand All @@ -30,7 +33,8 @@ def run(self):
author = "Patricio Cubillos",
author_email = "patricio.cubillos@oeaw.ac.at",
url = "https://github.com/pcubillos/bibmanager",
packages = ["bibmanager"],
packages = setuptools.find_packages(),
package_data = {'bibmanager':['config', 'examples/*']},
install_requires = ['numpy>=1.15.1',
'requests>=2.19.1',
'prompt_toolkit>=2.0.5',
Expand Down

0 comments on commit e7335d7

Please sign in to comment.