Mercurial > pyntnclick
comparison create-upload.py @ 531:60c345d19daf
PEP-8 cleanup of skellington bits in root
author | Stefano Rivera <stefano@rivera.za.net> |
---|---|
date | Sat, 11 Feb 2012 12:00:19 +0200 |
parents | f2c3b516741b |
children |
comparison
equal
deleted
inserted
replaced
530:fe51223e0c8d | 531:60c345d19daf |
---|---|
18 import zipfile | 18 import zipfile |
19 | 19 |
20 if len(sys.argv) != 2: | 20 if len(sys.argv) != 2: |
21 print '''Usage: python %s <release filename-version> | 21 print '''Usage: python %s <release filename-version> |
22 | 22 |
23 eg. python %s my_cool_game-1.0'''%(sys.argv[0], sys.argv[0]) | 23 eg. python %s my_cool_game-1.0''' % (sys.argv[0], sys.argv[0]) |
24 sys.exit() | 24 sys.exit() |
25 | 25 |
26 base = sys.argv[1] | 26 base = sys.argv[1] |
27 zipname = base + '.zip' | 27 zipname = base + '.zip' |
28 | 28 |
34 # core files | 34 # core files |
35 for name in 'README.txt run_game.py'.split(): | 35 for name in 'README.txt run_game.py'.split(): |
36 package.write(name, os.path.join(base, name)) | 36 package.write(name, os.path.join(base, name)) |
37 package.write('run_game.py', os.path.join(base, 'run_game.pyw')) | 37 package.write('run_game.py', os.path.join(base, 'run_game.pyw')) |
38 | 38 |
39 | |
39 # utility for adding subdirectories | 40 # utility for adding subdirectories |
40 def add_files(generator): | 41 def add_files(generator): |
41 for dirpath, dirnames, filenames in generator: | 42 for dirpath, dirnames, filenames in generator: |
42 for name in list(dirnames): | 43 for name in list(dirnames): |
43 if name == 'CVS' or name.startswith('.'): | 44 if name == 'CVS' or name.startswith('.'): |
44 dirnames.remove(name) | 45 dirnames.remove(name) |
45 | 46 |
46 for name in filenames: | 47 for name in filenames: |
47 if name.startswith('.'): continue | 48 if name.startswith('.'): |
49 continue | |
48 suffix = os.path.splitext(name)[1] | 50 suffix = os.path.splitext(name)[1] |
49 if suffix in ('.pyc', '.pyo'): continue | 51 if suffix in ('.pyc', '.pyo'): |
50 if name[0] == '.': continue | 52 continue |
53 if name[0] == '.': | |
54 continue | |
51 filename = os.path.join(dirpath, name) | 55 filename = os.path.join(dirpath, name) |
52 package.write(filename, os.path.join(base, filename)) | 56 package.write(filename, os.path.join(base, filename)) |
53 | 57 |
54 # add the lib and data directories | 58 # add the lib and data directories |
55 add_files(os.walk('gamelib')) | 59 add_files(os.walk('gamelib')) |