Skip to content

Commit

Permalink
Move all PEPs into subdirectory. Closes python#10
Browse files Browse the repository at this point in the history
This change moves all PEPs into the `peps/`
subdirectory. The HTML files generated by
`pep2html.py` will be located in `output/`.

The `make` to convert a single PEP to HTML
change slightly **if** you specify the path.
It's still the when specifying the id.

From: `make pep-0020.txt`
To: `make peps/pep-0020.txt`

... just use tab completion ;)
  • Loading branch information
timofurrer committed Jun 17, 2016
1 parent 92b5b19 commit e1fe95c
Show file tree
Hide file tree
Showing 442 changed files with 42 additions and 26 deletions.
17 changes: 9 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
pep-0000.txt
pep-????.html
__pycache__
*.pyc
*.pyo
*~
*env
.vscode
pep-0000.txt
pep-????.html
__pycache__
*.pyc
*.pyo
*~
*env
.vscode
*.swp
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,23 @@ PYTHON=python
.txt.html:
@$(PYTHON) $(PEP2HTML) $<

TARGETS=$(patsubst %.txt,%.html,$(wildcard pep-????.txt)) pep-0000.html
TARGETS=$(patsubst %.txt,%.html,$(wildcard peps/pep-????.txt)) output/pep-0000.html

all: pep-0000.txt $(TARGETS)

$(TARGETS): pep2html.py

pep-0000.txt: $(wildcard pep-????.txt) $(wildcard pep0/*.py)
$(PYTHON) genpepindex.py .
pep-0000.txt: $(wildcard peps/pep-????.txt) $(wildcard pep0/*.py)
$(PYTHON) genpepindex.py peps/

rss:
$(PYTHON) pep2rss.py .
$(PYTHON) pep2rss.py peps/

install:
echo "Installing is not necessary anymore. It will be done in post-commit."

clean:
-rm pep-0000.txt
-rm *.html
-rm -r output/

update:
git pull https://github.com/python/peps.git
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Python Enhancement Proposals
The PEPs in this repo are published automatically on the web at
http://www.python.org/dev/peps/. To learn more about the purpose of
PEPs and how to go about writing a PEP, please start reading at PEP 1
(``pep-0001.txt`` in this repo). Note that PEP 0, the index PEP, is
(``peps/pep-0001.txt`` in this repo). Note that PEP 0, the index PEP, is
now automatically generated, and not committed to the repo.


Expand All @@ -28,7 +28,7 @@ Generating HTML

Do not commit changes with bad formatting. To check the formatting of
a PEP, use the Makefile. In particular, to generate HTML for PEP 999,
your source code should be in ``pep-0999.txt`` and the HTML will be
generated to ``pep-0999.html`` by the command ``make pep-0999.html``.
your source code should be in ``peps/pep-0999.txt`` and the HTML will be
generated to ``output/pep-0999.html`` by the command ``make peps/pep-0999.html``.
The default Make target generates HTML for all PEPs. If you don't have
Make, use the ``pep2html.py`` script.
16 changes: 12 additions & 4 deletions genpepindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@

from operator import attrgetter

from pep0.output import write_pep0
from pep0.pep import PEP, PEPError
from peps.pep0.output import write_pep0
from peps.pep0.pep import PEP, PEPError

PEPDIR = "peps"
OUTPUTDIR = "output"


def main(argv):
if not argv[1:]:
path = '.'
path = PEPDIR
else:
path = argv[1]

Expand Down Expand Up @@ -61,7 +64,12 @@ def main(argv):
else:
raise ValueError("argument must be a directory or file path")

with codecs.open('pep-0000.txt', 'w', encoding='UTF-8') as pep0_file:
try:
os.makedirs(OUTPUTDIR)
except OSError: # output directory alrady exists. Everything's fine...
pass

with codecs.open(os.path.join(OUTPUTDIR, 'pep-0000.txt'), 'w', encoding='UTF-8') as pep0_file:
write_pep0(peps, pep0_file)

if __name__ == "__main__":
Expand Down
13 changes: 10 additions & 3 deletions pep2html.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
PROGRAM = sys.argv[0]
RFCURL = 'http://www.faqs.org/rfcs/rfc%d.html'
PEPURL = 'pep-%04d.html'
PEPDIR = 'peps'
OUTPUTDIR = 'output'
PEPCVSURL = ('https://hg.python.org/peps/file/tip/pep-%04d.txt')
PEPDIRRUL = 'http://www.python.org/peps/'

Expand Down Expand Up @@ -371,7 +373,7 @@ def find_pep(pep_str):
if os.path.exists(pep_str):
return pep_str
num = int(pep_str)
return "pep-%04d.txt" % num
return os.path.join(PEPDIR, "pep-%04d.txt" % num)

def make_html(inpath, verbose=0):
input_lines = get_input_lines(inpath)
Expand All @@ -390,7 +392,7 @@ def make_html(inpath, verbose=0):
elif PEP_TYPE_DISPATCH[pep_type] == None:
pep_type_error(inpath, pep_type)
return None
outpath = os.path.splitext(inpath)[0] + ".html"
outpath = os.path.join(OUTPUTDIR, os.path.splitext(os.path.basename(inpath))[0] + ".html")
if verbose:
print(inpath, "(%s)" % pep_type, "->", outpath)
sys.stdout.flush()
Expand Down Expand Up @@ -519,6 +521,11 @@ def main(argv=None):
elif opt in ('-b', '--browse'):
browse = 1

try:
os.makedirs(OUTPUTDIR)
except OSError: # output directory alrady exists. Everything's fine...
pass

if args:
peptxt = []
html = []
Expand All @@ -534,7 +541,7 @@ def main(argv=None):
# do them all
peptxt = []
html = []
files = glob.glob("pep-*.txt")
files = glob.glob(os.path.join(PEPDIR, "pep-*.txt"))
files.sort()
for file in files:
peptxt.append(file)
Expand Down
3 changes: 2 additions & 1 deletion pep2pyramid.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
PEPCVSURL = 'http://hg.python.org/peps/file/tip/pep-%04d.txt'
PEPDIRURL = '/dev/peps/'
PEPURL = PEPDIRURL + 'pep-%04d'
PEPDIR = 'peps'
PEPANCHOR = '<a href="' + PEPURL + '">%i</a>'


Expand Down Expand Up @@ -499,7 +500,7 @@ def build_peps(args=None):
filenames = pep_filename_generator(args)
else:
# do them all
filenames = glob.glob("pep-*.txt")
filenames = glob.glob(os.path.join(PEPDIR, "pep-*.txt"))
filenames.sort()
for filename in filenames:
try:
Expand Down
2 changes: 1 addition & 1 deletion pep2rss.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def firstline_startingwith(full_path, text):
return None

# get list of peps with creation time (from "Created:" string in pep .txt)
peps = glob.glob('pep-*.txt')
peps = glob.glob('peps/pep-*.txt')
def pep_creation_dt(full_path):
created_str = firstline_startingwith(full_path, 'Created:')
# bleh, I was hoping to avoid re but some PEPs editorialize
Expand Down
Empty file added peps/__init__.py
Empty file.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit e1fe95c

Please sign in to comment.