[Python-checkins] distutils2: Make the upload_docs command fallback on docs/ if doc/ is not found
tarek.ziade
python-checkins at python.org
Wed Sep 29 12:59:32 CEST 2010
tarek.ziade pushed 37f948f6be6c to distutils2:
http://hg.python.org/distutils2/rev/37f948f6be6c
changeset: 690:37f948f6be6c
tag: tip
user: anatoly techtonik <techtonik at gmail.com>
date: Wed Sep 29 11:38:40 2010 +0300
summary: Make the upload_docs command fallback on docs/ if doc/ is not found
files: distutils2/command/upload_docs.py, distutils2/tests/test_upload_docs.py, docs/source/distutils/newcommands.rst
diff --git a/distutils2/command/upload_docs.py b/distutils2/command/upload_docs.py
--- a/distutils2/command/upload_docs.py
+++ b/distutils2/command/upload_docs.py
@@ -84,6 +84,8 @@
if self.upload_dir is None:
build = self.get_finalized_command('build')
self.upload_dir = os.path.join(build.build_base, "docs")
+ if not os.path.isdir(self.upload_dir):
+ self.upload_dir = os.path.join(build.build_base, "doc")
self.announce('Using upload directory %s' % self.upload_dir)
self.verify_upload_dir(self.upload_dir)
config = read_pypirc(self.repository, self.realm)
diff --git a/distutils2/tests/test_upload_docs.py b/distutils2/tests/test_upload_docs.py
--- a/distutils2/tests/test_upload_docs.py
+++ b/distutils2/tests/test_upload_docs.py
@@ -76,6 +76,19 @@
finally:
os.chdir(previous)
+ def test_default_uploaddir_looks_for_doc_also(self):
+ sandbox = self.mkdtemp()
+ previous = os.getcwd()
+ os.chdir(sandbox)
+ try:
+ os.mkdir("build")
+ self.prepare_sample_dir("build")
+ os.rename(os.path.join("build", "docs"), os.path.join("build", "doc"))
+ self.cmd.ensure_finalized()
+ self.assertEqual(self.cmd.upload_dir, os.path.join("build", "doc"))
+ finally:
+ os.chdir(previous)
+
def prepare_sample_dir(self, sample_dir=None):
if sample_dir is None:
sample_dir = self.mkdtemp()
diff --git a/docs/source/distutils/newcommands.rst b/docs/source/distutils/newcommands.rst
--- a/docs/source/distutils/newcommands.rst
+++ b/docs/source/distutils/newcommands.rst
@@ -130,8 +130,8 @@
The ``upload_docs`` command has the following options:
``--upload-dir``
- The directory to be uploaded to the repository. The default value is
- ``docs`` in project root.
+ The directory to be uploaded to the repository. By default documentation
+ is searched for in ``docs`` (or ``doc``) directory in project root.
``--show-response``
Display the full response text from server; this is useful for debugging
--
Repository URL: http://hg.python.org/distutils2
More information about the Python-checkins
mailing list