Repository: cloud-custodian/cloud-custodian

Issue:
Docs generating issue
1. Create a folder with capitalized characters (absolute path to the project has at least 1 capitalized character).
2. Clone the project into the folder.
3. Run tox.
4. Run 'tox -e docs'

Actual result:
It returns an error of docs generation.

Expected result:
The docs are generated


Discussion:
it would help if you could state the actual error you're seeing. doc gen is working fine in ci.

if your referencing your last pull request failure to build docs, its because you have errors in your docs.
> it would help if you could state the actual error you're seeing. doc gen is working fine in ci.
> 
> if your referencing your last pull request failure to build docs, its because you have errors in your docs.

Here is a log of the error. The branch is master. It's reproduced only if path contains uppercase characters. For example PycharmProjects has them.

cp README.md docs/source/overview.md
cp tools/c7n_org/README.md docs/source/tools/c7n-org.md
cp tools/c7n_policystream/README.md docs/source/tools/c7n-policystream.md
cp tools/c7n_mailer/README.md docs/source/tools/c7n-mailer.md
cp tools/c7n_trailcreator/readme.md docs/source/tools/c7n-trailcreator.md
mkdir -p docs/source/aws/resources
c7n-sphinxext --provider aws --output-dir docs/source/aws/resources --group-by=resource_type.service
Traceback (most recent call last):
  File "/home/yauhen/PycharmProjects/cloud-custodian/tools/c7n_sphinxext/c7n_sphinxext/docgen.py", line 157, in main
    _main(provider, output_dir, group_by)
  File "/home/yauhen/PycharmProjects/cloud-custodian/tools/c7n_sphinxext/c7n_sphinxext/docgen.py", line 194, in _main
    with open(rpath, 'w') as fh:
FileNotFoundError: [Errno 2] No such file or directory: '/home/yauhen/pycharmprojects/cloud-custodian/docs/source/aws/resources/iam-group.rst'
> /home/yauhen/PycharmProjects/cloud-custodian/tools/c7n_sphinxext/c7n_sphinxext/docgen.py(194)_main()
-> with open(rpath, 'w') as fh:
(Pdb) 


Resolving patch:
diff --git a/tools/c7n_sphinxext/c7n_sphinxext/docgen.py b/tools/c7n_sphinxext/c7n_sphinxext/docgen.py
--- a/tools/c7n_sphinxext/c7n_sphinxext/docgen.py
+++ b/tools/c7n_sphinxext/c7n_sphinxext/docgen.py
@@ -162,7 +162,8 @@ def main(provider, output_dir, group_by):
 
 
 def resource_file_name(output_dir, r):
-    return os.path.join(output_dir, "%s.rst" % r.type).replace(' ', '-').lower()
+    return os.path.join(
+        output_dir, ("%s.rst" % r.type).replace(' ', '-').lower())
 
 
 def _main(provider, output_dir, group_by):
@@ -200,13 +201,15 @@ def _main(provider, output_dir, group_by):
     # Create files for all groups
     for key, group in sorted(groups.items()):
         group = sorted(group, key=operator.attrgetter('type'))
-        rpath = os.path.join(output_dir, "group-%s.rst" % key).replace(' ', '-').lower()
+        rpath = os.path.join(
+            output_dir, ("group-%s.rst" % key).replace(' ', '-').lower())
         with open(rpath, 'w') as fh:
             t = env.get_template('provider-group.rst')
             fh.write(t.render(
                 provider_name=provider,
                 key=key,
-                resource_files=[os.path.basename(resource_file_name(output_dir, r)) for r in group],
+                resource_files=[os.path.basename(
+                    resource_file_name(output_dir, r)) for r in group],
                 resources=group))
         files.append(os.path.basename(rpath))
 
@@ -225,7 +228,8 @@ def _main(provider, output_dir, group_by):
             common_actions[ElementSchema.name(a)] = (a, r)
 
     fpath = os.path.join(
-        output_dir, "%s-common-filters.rst" % provider_class.type.lower())
+        output_dir,
+        ("%s-common-filters.rst" % provider_class.type.lower()))
     with open(fpath, 'w') as fh:
         t = env.get_template('provider-common-elements.rst')
         fh.write(t.render(
@@ -235,7 +239,8 @@ def _main(provider, output_dir, group_by):
         files.insert(0, os.path.basename(fpath))
 
     fpath = os.path.join(
-        output_dir, "%s-common-actions.rst" % provider_class.type.lower())
+        output_dir,
+        ("%s-common-actions.rst" % provider_class.type.lower()))
     with open(fpath, 'w') as fh:
         t = env.get_template('provider-common-elements.rst')
         fh.write(t.render(


Test patch: