Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* 'master' of https://github.com/pineapplemachine/PyDwarf: (35 commits)
  Added a changelog, changelogs are cool
  Updated version numbers for manager.py, and raws and pydwarf packages
  Updated version numbers for scripts updated since v1.0.0
  Rebuilt shitty html documentation
  Tweaked material values in pineapple.greensteel
  Improvements to raws package
  Added parse and parseone to raws.__init__ for convenience
  Rewrote file.tokens method to call token.tokens instead of having its own logic
  More operator overload tomfoolery
  More fixes related to overloads, this time to raws.file.root and raws.file.tail
  Even more overload related fixes
  More bugfixes related to those infernal operator overloads
  Added some useful operator overloads to raws.tokenfilter
  Several additions and bugfixes
  Fixed logging error in pineapple.cavegrass
  Fixed response.__str__ method
  Even more documentation
  More raws.file documentation
  Added file attribute to raws.token
  More documentation and improved existing
  ...

Conflicts:
	.gitignore
	readme.md
  • Loading branch information
pineapplemachine committed Jun 22, 2015
2 parents d567713 + 7e6078b commit 1b1daa5
Show file tree
Hide file tree
Showing 22 changed files with 1,929 additions and 234 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
*.DS_Store
*.pyc
*.xcf
*test.py

# Manager logs go here
logs/*

# Outputted raws go here (for my personal testing and stuff anyway)
output/*
backup/*

# Older DF versions go here (for my help figuring version compatibility)
refs/*

# Stuff that's just not meant to be committed right now
build/*
28 changes: 28 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
v1.0.1: Strange Mood

Fixed pineapple.boneflux reaction by being less bad at string formatting
Fixed pineapple.utils.addreaction not adding an OBJECT:REACTION token to created files
Fixed new grasses in pineapple.cavegrass not being recognized by DF
Fixed a small issue with logging in pineapple.cavegrass
Fixed non-raws file from input directory not being written to output
Fixed pydwarf.response casting to string always returning a string starting with "SUCCESS" even when unsuccessful
Added a lot more documentation
Added a shitty WIP tool for outputting docstrings as more readable html
Added a list method to queryable raws objects which acts as a shortcut for raw.tokenlist(something.tokens())
Added a file attribute to raws.token objects for tracking which file they belong to, if any
Added a bunch of helpful operator overloads
Added length and clear methods to raws.file
Added some convenience things to the raws package: raws.parse and raws.parseone refer to the raws.token static methods, raws.filter refers to raws.tokenfilter
Added index and slice functionality to raws.token and raws.file, most easily accessible via conventional notations like token[1] or token[-8:0:2]
Added step argument to tokens method for raws.token and raws.file
Improved error handling for bad config settings
Improved raws.tokenlist casting to string
Improved objdict method to return a dictionary of raws.tokenlist objects where previously they were regular lists
Improved handling of assignment of illegal strings to token text, now automatically resolves some common pitfalls
Improved argument handling for raws.boolfilter static methods all, any, one, and none
Tweaked grass colors in pineapple.cavegrass
Tweaked names, craftable items, and material values in pineapple.greensteel

v1.0.0: A New Hope

First Release
13 changes: 8 additions & 5 deletions config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,13 @@ def setuplogger(self):
stdouthandler.setFormatter(logging.Formatter('%(asctime)s: %(levelname)s: %(message)s', datetimeformat))
pydwarf.log.addHandler(stdouthandler)
# Handler for log file output
logfilehandler = logging.FileHandler(self.log)
logfilehandler.setLevel(logging.DEBUG)
logfilehandler.setFormatter(logging.Formatter('%(asctime)s: %(filename)s[%(lineno)s]: %(levelname)s: %(message)s', datetimeformat))
pydwarf.log.addHandler(logfilehandler)
if self.log:
logdir = os.path.dirname(self.log)
if not os.path.exists(logdir): os.makedirs(logdir)
logfilehandler = logging.FileHandler(self.log)
logfilehandler.setLevel(logging.DEBUG)
logfilehandler.setFormatter(logging.Formatter('%(asctime)s: %(filename)s[%(lineno)s]: %(levelname)s: %(message)s', datetimeformat))
pydwarf.log.addHandler(logfilehandler)

def setuppackages(self):
self.importedpackages = [importlib.import_module(package) for package in self.packages]
Expand All @@ -76,7 +79,7 @@ def setupversion(self):
pydwarf.log.info('Unable to detect Dwarf Fortress version.')
else:
pydwarf.log.info('Detected Dwarf Fortress version %s.' % self.version)
elif conf.version is None:
elif self.version is None:
pydwarf.log.warning('No Dwarf Fortress version was specified. Scripts will be run regardless of their indicated compatibility.')
else:
pydwarf.log.info('Managing Dwarf Fortress version %s.' % self.version)
Expand Down
51 changes: 51 additions & 0 deletions docs/build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Disclaimer: This is a shitty WIP

import sys
import os

sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))

import inspect

import raws
import pydwarf

output = 'index.html'

items = {
'raws.token': raws.token,
'raws.file': raws.file,
'raws.dir': raws.dir,
'raws.color': raws.color,
'raws.tokenfilter': raws.tokenfilter,
'raws.boolfilter': raws.boolfilter,
'pydwarf.session': pydwarf.session,
'pydwarf.urist': pydwarf.urist
}

alldoc = {}
for itemname, item in items.iteritems():
itemdoc = {}
alldoc[itemname] = itemdoc

for membername, member in inspect.getmembers(item):
memdoc = {}
itemdoc[membername] = member

with open(output, 'wb') as html:
css = 'pre { background-color: #ddd; color: #113 }'
html.write('<html><head><title>%(title)s</title><style>%(style)s</style></head><body>' % {'title': 'PyDwarf docs', 'style': css})
html.write('<h1 style="font-size: 50; color: #800">Warning: This is a shitty WIP.</h1>')
for itemname in sorted(alldoc.iterkeys()):
itemdoc = alldoc[itemname]
html.write('<h1>%s</h1>' % itemname)
for membername in sorted(itemdoc.iterkeys()):
member = itemdoc[membername]
if callable(member) and membername not in ('__module__', '__str__', '__repr__', '__doc__'):
html.write('<p><b>%s</b><br><pre>%s</pre></p>' % (membername, member.__doc__))
html.write('</body></html>')





Loading

0 comments on commit 1b1daa5

Please sign in to comment.