From f123bc3ad18f4478fc2e23575dc00eefe096637a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Boulogne?= Date: Thu, 10 Jul 2014 22:50:16 -0400 Subject: [PATCH 1/3] add lib directory --- bmc.py | 10 +++++----- libbmc/__init__.py | 4 ++++ backend.py => libbmc/backend.py | 0 config.py => libbmc/config.py | 0 fetcher.py => libbmc/fetcher.py | 0 search.py => libbmc/search.py | 0 {tests => libbmc/tests}/src/arxiv.bib | 0 {tests => libbmc/tests}/src/doi.bib | 0 {tests => libbmc/tests}/src/isbn.bib | 0 {tests => libbmc/tests}/src/test.djvu | Bin {tests => libbmc/tests}/src/test.pdf | Bin {tests => libbmc/tests}/src/test_arxiv_multi.pdf | Bin .../tests}/src/test_arxiv_published.pdf | Bin {tests => libbmc/tests}/src/test_book.djvu | Bin {tests => libbmc/tests}/src/test_book.pdf | Bin {tests => libbmc/tests}/src/test_hal.pdf | Bin {tests => libbmc/tests}/src/test_watermark.pdf | Bin {tests => libbmc/tests}/test_backend.py | 0 {tests => libbmc/tests}/test_config.py | 0 {tests => libbmc/tests}/test_fetcher.py | 0 {tests => libbmc/tests}/test_tools.py | 0 tools.py => libbmc/tools.py | 0 22 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 libbmc/__init__.py rename backend.py => libbmc/backend.py (100%) rename config.py => libbmc/config.py (100%) rename fetcher.py => libbmc/fetcher.py (100%) rename search.py => libbmc/search.py (100%) rename {tests => libbmc/tests}/src/arxiv.bib (100%) rename {tests => libbmc/tests}/src/doi.bib (100%) rename {tests => libbmc/tests}/src/isbn.bib (100%) rename {tests => libbmc/tests}/src/test.djvu (100%) rename {tests => libbmc/tests}/src/test.pdf (100%) rename {tests => libbmc/tests}/src/test_arxiv_multi.pdf (100%) rename {tests => libbmc/tests}/src/test_arxiv_published.pdf (100%) rename {tests => libbmc/tests}/src/test_book.djvu (100%) rename {tests => libbmc/tests}/src/test_book.pdf (100%) rename {tests => libbmc/tests}/src/test_hal.pdf (100%) rename {tests => libbmc/tests}/src/test_watermark.pdf (100%) rename {tests => libbmc/tests}/test_backend.py (100%) rename {tests => libbmc/tests}/test_config.py (100%) rename {tests => libbmc/tests}/test_fetcher.py (100%) rename {tests => libbmc/tests}/test_tools.py (100%) rename tools.py => libbmc/tools.py (100%) diff --git a/bmc.py b/bmc.py index 2815512..90fe6a9 100755 --- a/bmc.py +++ b/bmc.py @@ -7,13 +7,13 @@ import shutil import subprocess import sys import tempfile -import backend -import fetcher -import tearpages -import tools from bibtexparser.bparser import BibTexParser from codecs import open -from config import Config +from libbmc.config import Config +from libbmc import backend +from libbmc import fetcher +from libbmc import tearpages +from libbmc import tools config = Config() diff --git a/libbmc/__init__.py b/libbmc/__init__.py new file mode 100644 index 0000000..13c7609 --- /dev/null +++ b/libbmc/__init__.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python2 +# -*- coding: utf-8 -*- + + diff --git a/backend.py b/libbmc/backend.py similarity index 100% rename from backend.py rename to libbmc/backend.py diff --git a/config.py b/libbmc/config.py similarity index 100% rename from config.py rename to libbmc/config.py diff --git a/fetcher.py b/libbmc/fetcher.py similarity index 100% rename from fetcher.py rename to libbmc/fetcher.py diff --git a/search.py b/libbmc/search.py similarity index 100% rename from search.py rename to libbmc/search.py diff --git a/tests/src/arxiv.bib b/libbmc/tests/src/arxiv.bib similarity index 100% rename from tests/src/arxiv.bib rename to libbmc/tests/src/arxiv.bib diff --git a/tests/src/doi.bib b/libbmc/tests/src/doi.bib similarity index 100% rename from tests/src/doi.bib rename to libbmc/tests/src/doi.bib diff --git a/tests/src/isbn.bib b/libbmc/tests/src/isbn.bib similarity index 100% rename from tests/src/isbn.bib rename to libbmc/tests/src/isbn.bib diff --git a/tests/src/test.djvu b/libbmc/tests/src/test.djvu similarity index 100% rename from tests/src/test.djvu rename to libbmc/tests/src/test.djvu diff --git a/tests/src/test.pdf b/libbmc/tests/src/test.pdf similarity index 100% rename from tests/src/test.pdf rename to libbmc/tests/src/test.pdf diff --git a/tests/src/test_arxiv_multi.pdf b/libbmc/tests/src/test_arxiv_multi.pdf similarity index 100% rename from tests/src/test_arxiv_multi.pdf rename to libbmc/tests/src/test_arxiv_multi.pdf diff --git a/tests/src/test_arxiv_published.pdf b/libbmc/tests/src/test_arxiv_published.pdf similarity index 100% rename from tests/src/test_arxiv_published.pdf rename to libbmc/tests/src/test_arxiv_published.pdf diff --git a/tests/src/test_book.djvu b/libbmc/tests/src/test_book.djvu similarity index 100% rename from tests/src/test_book.djvu rename to libbmc/tests/src/test_book.djvu diff --git a/tests/src/test_book.pdf b/libbmc/tests/src/test_book.pdf similarity index 100% rename from tests/src/test_book.pdf rename to libbmc/tests/src/test_book.pdf diff --git a/tests/src/test_hal.pdf b/libbmc/tests/src/test_hal.pdf similarity index 100% rename from tests/src/test_hal.pdf rename to libbmc/tests/src/test_hal.pdf diff --git a/tests/src/test_watermark.pdf b/libbmc/tests/src/test_watermark.pdf similarity index 100% rename from tests/src/test_watermark.pdf rename to libbmc/tests/src/test_watermark.pdf diff --git a/tests/test_backend.py b/libbmc/tests/test_backend.py similarity index 100% rename from tests/test_backend.py rename to libbmc/tests/test_backend.py diff --git a/tests/test_config.py b/libbmc/tests/test_config.py similarity index 100% rename from tests/test_config.py rename to libbmc/tests/test_config.py diff --git a/tests/test_fetcher.py b/libbmc/tests/test_fetcher.py similarity index 100% rename from tests/test_fetcher.py rename to libbmc/tests/test_fetcher.py diff --git a/tests/test_tools.py b/libbmc/tests/test_tools.py similarity index 100% rename from tests/test_tools.py rename to libbmc/tests/test_tools.py diff --git a/tools.py b/libbmc/tools.py similarity index 100% rename from tools.py rename to libbmc/tools.py From 22e4a09bda97311d01984ea49f6b1cbbf16228e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Boulogne?= Date: Thu, 10 Jul 2014 22:52:49 -0400 Subject: [PATCH 2/3] fix import --- libbmc/tests/test_backend.py | 2 +- libbmc/tests/test_config.py | 2 +- libbmc/tests/test_fetcher.py | 2 +- libbmc/tests/test_tools.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libbmc/tests/test_backend.py b/libbmc/tests/test_backend.py index 530eb9b..3ef98e5 100644 --- a/libbmc/tests/test_backend.py +++ b/libbmc/tests/test_backend.py @@ -9,7 +9,7 @@ # Phyks # ----------------------------------------------------------------------------- import unittest -from backend import * +from libbmc.backend import * from bibtexparser.bparser import BibTexParser import os import shutil diff --git a/libbmc/tests/test_config.py b/libbmc/tests/test_config.py index 52af6f7..dda96d2 100644 --- a/libbmc/tests/test_config.py +++ b/libbmc/tests/test_config.py @@ -9,11 +9,11 @@ # Phyks # ----------------------------------------------------------------------------- import unittest -from config import Config import json import os import tempfile import shutil +from libbmc.config import Config class TestConfig(unittest.TestCase): diff --git a/libbmc/tests/test_fetcher.py b/libbmc/tests/test_fetcher.py index 38322d7..9ddac7a 100644 --- a/libbmc/tests/test_fetcher.py +++ b/libbmc/tests/test_fetcher.py @@ -10,7 +10,7 @@ # ----------------------------------------------------------------------------- import unittest -from fetcher import * +from libbmc.fetcher import * class TestFetcher(unittest.TestCase): diff --git a/libbmc/tests/test_tools.py b/libbmc/tests/test_tools.py index bda2cbd..752ed39 100644 --- a/libbmc/tests/test_tools.py +++ b/libbmc/tests/test_tools.py @@ -10,7 +10,7 @@ # ----------------------------------------------------------------------------- import unittest -from tools import * +from libbmc.tools import * class TestTools(unittest.TestCase): From 7e570322c06496352ac0435bfff64a6b0425aba8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Boulogne?= Date: Thu, 10 Jul 2014 22:56:47 -0400 Subject: [PATCH 3/3] fix paths --- libbmc/tests/test_fetcher.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/libbmc/tests/test_fetcher.py b/libbmc/tests/test_fetcher.py index 9ddac7a..23f30f2 100644 --- a/libbmc/tests/test_fetcher.py +++ b/libbmc/tests/test_fetcher.py @@ -15,11 +15,11 @@ from libbmc.fetcher import * class TestFetcher(unittest.TestCase): def setUp(self): - with open("tests/src/doi.bib", 'r') as fh: + with open("libbmc/tests/src/doi.bib", 'r') as fh: self.doi_bib = fh.read() - with open("tests/src/arxiv.bib", 'r') as fh: + with open("libbmc/tests/src/arxiv.bib", 'r') as fh: self.arxiv_bib = fh.read() - with open("tests/src/isbn.bib", 'r') as fh: + with open("libbmc/tests/src/isbn.bib", 'r') as fh: self.isbn_bib = fh.read() def test_download(self): @@ -35,13 +35,13 @@ class TestFetcher(unittest.TestCase): def test_findISBN_DJVU(self): # ISBN is incomplete in this test because my djvu file is bad - self.assertEqual(findISBN("tests/src/test_book.djvu"), '978295391873') + self.assertEqual(findISBN("libbmc/tests/src/test_book.djvu"), '978295391873') def test_findISBN_PDF(self): - self.assertEqual(findISBN("tests/src/test_book.pdf"), '9782953918731') + self.assertEqual(findISBN("libbmc/tests/src/test_book.pdf"), '9782953918731') def test_findISBN_False(self): - self.assertFalse(findISBN("tests/src/test.pdf")) + self.assertFalse(findISBN("libbmc/tests/src/test.pdf")) def test_isbn2Bib(self): self.assertEqual(isbn2Bib('0198507194'), self.isbn_bib) @@ -50,16 +50,16 @@ class TestFetcher(unittest.TestCase): self.assertEqual(isbn2Bib('foo'), '') def test_findDOI_PDF(self): - self.assertEqual(findDOI("tests/src/test.pdf"), + self.assertEqual(findDOI("libbmc/tests/src/test.pdf"), "10.1103/physrevlett.112.253201") def test_findDOI_DJVU(self): # DOI is incomplete in this test because my djvu file is bad - self.assertEqual(findDOI("tests/src/test.djvu"), + self.assertEqual(findDOI("libbmc/tests/src/test.djvu"), "10.1103/physrevlett.112") def test_findDOI_False(self): - self.assertFalse(findDOI("tests/src/test_arxiv_multi.pdf")) + self.assertFalse(findDOI("libbmc/tests/src/test_arxiv_multi.pdf")) def test_doi2Bib(self): self.assertEqual(doi2Bib('10.1103/physreva.88.043630'), self.doi_bib) @@ -68,7 +68,7 @@ class TestFetcher(unittest.TestCase): self.assertEqual(doi2Bib('blabla'), '') def test_findArXivId(self): - self.assertEqual(findArXivId("tests/src/test_arxiv_multi.pdf"), + self.assertEqual(findArXivId("libbmc/tests/src/test_arxiv_multi.pdf"), '1303.3130v1') def test_arXiv2Bib(self): @@ -78,7 +78,7 @@ class TestFetcher(unittest.TestCase): self.assertEqual(arXiv2Bib('blabla'), '') def test_findHALId(self): - self.assertTupleEqual(findHALId("tests/src/test_hal.pdf"), + self.assertTupleEqual(findHALId("libbmc/tests/src/test_hal.pdf"), ('hal-00750893', '3')) if __name__ == '__main__':