Example #1
0
 def test_tempfile_without_error(self):
     path, filename, fd = self._tempfile(b"== noerror ==")
     try:
         long_description = get_long_description(path, filename, raise_errors=True)
         self.assertEqual(long_description, "-------\nnoerror\n-------")
     finally:
         fd.close()
Example #2
0
 def test_get_long_description_without_raise_errors(self):
     long_description = get_long_description(CREOLE_PACKAGE_ROOT, raise_errors=False)
     self.assertIn("=====\nabout\n=====\n\n", long_description)
     # Test created ReSt code
     from creole.rest2html.clean_writer import rest2html
     html = rest2html(long_description)
     self.assertIn("<h1>about</h1>\n", html)
 def test_tempfile_without_error(self):
     path, filename, fd = self._tempfile(b"== noerror ==")
     try:
         long_description = get_long_description(path, filename, raise_errors=True)
         self.assertEqual(long_description, "-------\nnoerror\n-------")
     finally:
         fd.close()
 def test_get_long_description_without_raise_errors(self):
     long_description = get_long_description(CREOLE_PACKAGE_ROOT, raise_errors=False)
     self.assertIn("=====\nabout\n=====\n\n", long_description)
     # Test created ReSt code
     from creole.rest_tools.clean_writer import rest2html
     html = rest2html(long_description)
     self.assertIn("<h1>about</h1>\n", html)
Example #5
0
    def test_readme_encoding(self):
        long_description = get_long_description(TEST_README_DIR, filename=TEST_README_FILENAME, raise_errors=True)

        if PY3:
            self.assertTrue(isinstance(long_description, TEXT_TYPE))
        else:
            self.assertTrue(isinstance(long_description, BINARY_TYPE))

        txt = "German Umlaute: ä ö ü ß Ä Ö Ü"
        if not PY3:
            txt = txt.encode("utf-8")
        self.assertIn(txt, long_description)
    def test_readme_encoding(self):
        long_description = get_long_description(TEST_README_DIR, filename=TEST_README_FILENAME, raise_errors=True)

        if PY3:
            self.assertTrue(isinstance(long_description, TEXT_TYPE))
        else:
            self.assertTrue(isinstance(long_description, BINARY_TYPE))

        txt = "German Umlaute: ä ö ü ß Ä Ö Ü"
        if not PY3:
            txt = txt.encode("utf-8")
        self.assertIn(txt, long_description)
Example #7
0

# convert creole to ReSt on-the-fly, see also:
# https://code.google.com/p/python-creole/wiki/UseInSetup
try:
    from creole.setup_utils import get_long_description
except ImportError:
    if "register" in sys.argv or "sdist" in sys.argv or "--long-description" in sys.argv:
        etype, evalue, etb = sys.exc_info()
        evalue = etype(
            "%s - Please install python-creole >= v0.8 -  e.g.: pip install python-creole"
            % evalue)
        raise etype(evalue).with_traceback(etb)
    long_description = None
else:
    long_description = get_long_description(PACKAGE_ROOT)


def get_authors():
    authors = []
    try:
        f = file(os.path.join(PACKAGE_ROOT, "AUTHORS"), "r")
        for line in f:
            if not line.strip().startswith("*"):
                continue
            if "--" in line:
                line = line.split("--", 1)[0]
            authors.append(line.strip(" *\r\n"))
        f.close()
        authors.sort()
    except Exception as err:
Example #8
0
PACKAGE_ROOT = os.path.dirname(os.path.abspath(__file__))


# convert README.creole on-the-fly to ReSt, see also:
# https://github.com/jedie/python-creole/wiki/Use-In-Setup/
check_readme="publish" in sys.argv or "check" in sys.argv or "register" in sys.argv or "sdist" in sys.argv or "--long-description" in sys.argv
try:
    from creole.setup_utils import get_long_description
except ImportError as err:
    if check_readme:
        raise ImportError("%s - Please install python-creole >= v0.8 -  e.g.: pip install python-creole" % err)
    long_description = None
else:
    if check_readme:
        print("\nCheck creole2ReSt:")
    long_description = get_long_description(PACKAGE_ROOT)
    if check_readme:
        print("OK")


if "publish" in sys.argv:
    """
    Build and upload to PyPi, if...
        ... __version__ doesn't contains "dev"
        ... we are on git 'master' branch
        ... git repository is 'clean' (no changed files)

    Upload with "twine", git tag the current version and git push --tag

    The cli arguments will be pass to 'twine'. So this is possible:
     * Display 'twine' help page...: ./setup.py publish --help
Example #9
0
 def test_get_long_description_with_raise_errors(self):
     long_description = get_long_description(CREOLE_PACKAGE_ROOT, raise_errors=True)
     self.assertIn("=====\nabout\n=====\n\n", long_description)
Example #10
0
 def test_wrong_path_without_raise_errors(self):
     self.assertEqual(
         get_long_description("wrong/path", raise_errors=False).replace("u'", "'"),
         "[Error: [Errno 2] No such file or directory: 'wrong/path/README.creole']\n"
     )
 def test_get_long_description_with_raise_errors(self):
     long_description = get_long_description(CREOLE_PACKAGE_ROOT, raise_errors=True)
     self.assertIn("=====\nabout\n=====\n\n", long_description)
 def test_wrong_path_without_raise_errors(self):
     self.assertEqual(
         get_long_description("wrong/path", raise_errors=False).replace("u'", "'"),
         "[Error: [Errno 2] No such file or directory: 'wrong/path/README.creole']\n"
     )