Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pystache_custom
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pystache_custom
Commits
6c453635
Commit
6c453635
authored
May 06, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a check to setup publish to confirm that setup_description.rst is up-to-date.
parent
4bcb64aa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
9 deletions
+35
-9
setup.py
+35
-9
No files found.
setup.py
View file @
6c453635
...
...
@@ -97,6 +97,10 @@ LICENSE_PATH = 'LICENSE'
DESCRIPTION_PATH
=
'setup_description.rst'
TEMP_REST_EXTENSION
=
'.temp.rst'
PREP_COMMAND
=
'prep'
CLASSIFIERS
=
(
'Development Status :: 4 - Beta'
,
'License :: OSI Approved :: MIT License'
,
...
...
@@ -143,7 +147,13 @@ def write(u, path):
f
.
close
()
def
prep
():
def
make_temp_path
(
path
):
root
,
ext
=
os
.
path
.
splitext
(
path
)
temp_path
=
root
+
TEMP_REST_EXTENSION
return
temp_path
def
make_description_file
(
target_path
):
"""
Generate the long_description needed for setup.py.
...
...
@@ -170,15 +180,32 @@ License
description
=
'
\n
'
.
join
(
sections
)
write
(
description
,
DESCRIPTION_PATH
)
write
(
description
,
target_path
)
def
prep
():
make_description_file
(
DESCRIPTION_PATH
)
def
publish
():
"""
Publish this package to PyPI (aka "the Cheeseshop").
"""
answer
=
raw_input
(
"Are you sure (yes/no)?"
)
temp_path
=
make_temp_path
(
DESCRIPTION_PATH
)
make_description_file
(
temp_path
)
if
read
(
temp_path
)
!=
read
(
DESCRIPTION_PATH
):
print
(
"""
\
Description file not up-to-date:
%
s
Run the following command and commit the changes--
python setup.py
%
s
"""
%
(
DESCRIPTION_PATH
,
PREP_COMMAND
))
sys
.
exit
()
print
(
"Description up-to-date:
%
s"
%
DESCRIPTION_PATH
)
answer
=
raw_input
(
"Are you sure you want to publish to PyPI (yes/no)?"
)
if
answer
!=
"yes"
:
exit
(
"Aborted: nothing published"
)
...
...
@@ -193,15 +220,14 @@ def convert_md_to_rst(path):
Returns the new path.
"""
root
,
ext
=
os
.
path
.
splitext
(
path
)
new_path
=
root
+
".temp.rst"
print
(
"Converting:
%
s to
%
s"
%
(
path
,
new_path
))
temp_path
=
make_temp_path
(
path
)
print
(
"Converting:
%
s to
%
s"
%
(
path
,
temp_path
))
# Pandoc uses the UTF-8 character encoding for both input and output.
command
=
"pandoc --write=rst --output=
%
s
%
s"
%
(
new
_path
,
path
)
command
=
"pandoc --write=rst --output=
%
s
%
s"
%
(
temp
_path
,
path
)
os
.
system
(
command
)
return
new
_path
return
temp
_path
# We follow the guidance here for compatibility with using setuptools instead
...
...
@@ -259,7 +285,7 @@ def main(sys_argv):
if
command
==
'publish'
:
publish
()
sys
.
exit
()
elif
command
==
'prep'
:
elif
command
==
PREP_COMMAND
:
prep
()
sys
.
exit
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment