New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "mkdocs" command creation in Windows #122

Merged
merged 2 commits into from Aug 20, 2014

Conversation

Projects
None yet
3 participants
@edbrannin
Contributor

edbrannin commented Aug 17, 2014

This makes a "mkdocs" command on Windows/OSX/Linux without any platform-specific code in setup.py.

I think this is the preferred way to install a Python command with setuptools.

It is, at least, the method used by (among others):


I finally figured out what was causing my previous windows-related PRs to get all funny about imports:

In the past, I had to relativize imports willy-nilly or add from __future__ import absolute_imports to a bunch of files.
This is because I was renaming mkdocs/mkdocs to mkdocs/mkdocs.py, and the module-vs-script name clash was confusing imports from other files. Now I'm changing it to mkdocs/main.py.

Updated setup.py to use entry_points['console_scripts'] instead of sc…
…ripts.

This makes a "mkdocs" command on Windows/OSX/Linux without any platform-specific code in setup.py.

I think this is the preferred way to install a Python command with setuptools.

It is, at least, the method used by:

* [flake8](https://bitbucket.org/tarek/flake8/src/8ee94d1eeea36e835583b68c59682bfc3684fab9/setup.py?at=default)
* [coverage.py](https://bitbucket.org/ned/coveragepy/src/ca875e739048c3b333e862471b89d55e3c7b7170/setup.py?at=default)
* [Fabric](https://github.com/fabric/fabric/blob/master/setup.py)
* Many others

In the past, I had to change imports willy-nilly or add
"from __future__ import absolute_imports" to a bunch of files.
This is because I was renaming "mkdocs" to "mkdocs.py" instead of "main.py",
and the module-vs-script name clash was confusing imports from other files.
@edbrannin

This comment has been minimized.

Contributor

edbrannin commented Aug 17, 2014

My last commit says "how did this ever pass?" -- the answer is because the code in mkdocs/main.py was ignored by pep8 because mkdocs/mkdocs doens't with with .py.

@d0ugal

This comment has been minimized.

Member

d0ugal commented Aug 20, 2014

Looks good to me, my main concern is that we don't actually test the install process on Travis currently. I'm addressing that in #125. However, I think this is fine to merge. I'll aim to land it after #125.

@tomchristie

This comment has been minimized.

Contributor

tomchristie commented Aug 20, 2014

@d0ugal I wouldn't worry about automated testing of the install process. Those kinda things change super rarely, and you know about em soon if ya screw it up. :)

@d0ugal

This comment has been minimized.

Member

d0ugal commented Aug 20, 2014

Alrightly, merging!

d0ugal added a commit that referenced this pull request Aug 20, 2014

Merge pull request #122 from edbrannin/windows-command
Fix "mkdocs" command creation in Windows

@d0ugal d0ugal merged commit 83ed147 into mkdocs:master Aug 20, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details
@edbrannin

This comment has been minimized.

Contributor

edbrannin commented Aug 20, 2014

@tomchristie OTOH, if the full-stack integration test weren't commented out, it would be a decent way to see if mkdocs can execute properly on all platforms. :)

(I uncommented it for local work when I was initially developing these Windows PRs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment