forked from vincentfretin/collective.pullrequestreview
/
1.patch
832 lines (787 loc) · 25.7 KB
/
1.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
From 4b9d3b8ef477af5293af195228788c17fd9818f5 Mon Sep 17 00:00:00 2001
From: Vincent Fretin <vincent.fretin@gmail.com>
Date: Mon, 7 Nov 2011 19:58:03 +0100
Subject: [PATCH 1/6] update bootstrap.py and pinned packages
---
bootstrap.py | 271 +++++++++++++++++++++++++++++++++++++++++++---------------
buildout.cfg | 1 +
versions.cfg | 102 +++-------------------
3 files changed, 219 insertions(+), 155 deletions(-)
diff --git a/bootstrap.py b/bootstrap.py
index ecb871e..7647cbb 100644
--- a/bootstrap.py
+++ b/bootstrap.py
@@ -1,6 +1,6 @@
##############################################################################
#
-# Copyright (c) 2006 Zope Corporation and Contributors.
+# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
@@ -16,112 +16,247 @@
Simply run this script in a directory containing a buildout.cfg.
The script accepts buildout command-line options, so you can
use the -c option to specify an alternate configuration file.
-
-$Id$
"""
-import os, shutil, sys, tempfile, urllib2
+import os, shutil, sys, tempfile, urllib, urllib2, subprocess
from optparse import OptionParser
-tmpeggs = tempfile.mkdtemp()
+if sys.platform == 'win32':
+ def quote(c):
+ if ' ' in c:
+ return '"%s"' % c # work around spawn lamosity on windows
+ else:
+ return c
+else:
+ quote = str
+
+# See zc.buildout.easy_install._has_broken_dash_S for motivation and comments.
+stdout, stderr = subprocess.Popen(
+ [sys.executable, '-Sc',
+ 'try:\n'
+ ' import ConfigParser\n'
+ 'except ImportError:\n'
+ ' print 1\n'
+ 'else:\n'
+ ' print 0\n'],
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
+has_broken_dash_S = bool(int(stdout.strip()))
+
+# In order to be more robust in the face of system Pythons, we want to
+# run without site-packages loaded. This is somewhat tricky, in
+# particular because Python 2.6's distutils imports site, so starting
+# with the -S flag is not sufficient. However, we'll start with that:
+if not has_broken_dash_S and 'site' in sys.modules:
+ # We will restart with python -S.
+ args = sys.argv[:]
+ args[0:0] = [sys.executable, '-S']
+ args = map(quote, args)
+ os.execv(sys.executable, args)
+# Now we are running with -S. We'll get the clean sys.path, import site
+# because distutils will do it later, and then reset the path and clean
+# out any namespace packages from site-packages that might have been
+# loaded by .pth files.
+clean_path = sys.path[:]
+import site # imported because of its side effects
+sys.path[:] = clean_path
+for k, v in sys.modules.items():
+ if k in ('setuptools', 'pkg_resources') or (
+ hasattr(v, '__path__') and
+ len(v.__path__) == 1 and
+ not os.path.exists(os.path.join(v.__path__[0], '__init__.py'))):
+ # This is a namespace package. Remove it.
+ sys.modules.pop(k)
is_jython = sys.platform.startswith('java')
+setuptools_source = 'http://peak.telecommunity.com/dist/ez_setup.py'
+distribute_source = 'http://python-distribute.org/distribute_setup.py'
+
+
# parsing arguments
-parser = OptionParser(
- 'This is a custom version of the zc.buildout %prog script. It is '
- 'intended to meet a temporary need if you encounter problems with '
- 'the zc.buildout 1.5 release.')
-parser.add_option("-v", "--version", dest="version", default='1.4.4',
- help='Use a specific zc.buildout version. *This '
- 'bootstrap script defaults to '
- '1.4.4, unlike usual buildpout bootstrap scripts.*')
-parser.add_option("-d", "--distribute",
- action="store_true", dest="distribute", default=False,
- help="Use Disribute rather than Setuptools.")
+def normalize_to_url(option, opt_str, value, parser):
+ if value:
+ if '://' not in value: # It doesn't smell like a URL.
+ value = 'file://%s' % (
+ urllib.pathname2url(
+ os.path.abspath(os.path.expanduser(value))),)
+ if opt_str == '--download-base' and not value.endswith('/'):
+ # Download base needs a trailing slash to make the world happy.
+ value += '/'
+ else:
+ value = None
+ name = opt_str[2:].replace('-', '_')
+ setattr(parser.values, name, value)
+
+usage = '''\
+[DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options]
+
+Bootstraps a buildout-based project.
+Simply run this script in a directory containing a buildout.cfg, using the
+Python that you want bin/buildout to use.
+
+Note that by using --setup-source and --download-base to point to
+local resources, you can keep this script from going over the network.
+'''
+
+parser = OptionParser(usage=usage)
+parser.add_option("-v", "--version", dest="version",
+ help="use a specific zc.buildout version")
+parser.add_option("-d", "--distribute",
+ action="store_true", dest="use_distribute", default=False,
+ help="Use Distribute rather than Setuptools.")
+parser.add_option("--setup-source", action="callback", dest="setup_source",
+ callback=normalize_to_url, nargs=1, type="string",
+ help=("Specify a URL or file location for the setup file. "
+ "If you use Setuptools, this will default to " +
+ setuptools_source + "; if you use Distribute, this "
+ "will default to " + distribute_source + "."))
+parser.add_option("--download-base", action="callback", dest="download_base",
+ callback=normalize_to_url, nargs=1, type="string",
+ help=("Specify a URL or directory for downloading "
+ "zc.buildout and either Setuptools or Distribute. "
+ "Defaults to PyPI."))
+parser.add_option("--eggs",
+ help=("Specify a directory for storing eggs. Defaults to "
+ "a temporary directory that is deleted when the "
+ "bootstrap script completes."))
+parser.add_option("-t", "--accept-buildout-test-releases",
+ dest='accept_buildout_test_releases',
+ action="store_true", default=False,
+ help=("Normally, if you do not specify a --version, the "
+ "bootstrap script and buildout gets the newest "
+ "*final* versions of zc.buildout and its recipes and "
+ "extensions for you. If you use this flag, "
+ "bootstrap and buildout will get the newest releases "
+ "even if they are alphas or betas."))
parser.add_option("-c", None, action="store", dest="config_file",
help=("Specify the path to the buildout configuration "
"file to be used."))
options, args = parser.parse_args()
-# if -c was provided, we push it back into args for buildout' main function
+# if -c was provided, we push it back into args for buildout's main function
if options.config_file is not None:
args += ['-c', options.config_file]
-if options.version is not None:
- VERSION = '==%s' % options.version
+if options.eggs:
+ eggs_dir = os.path.abspath(os.path.expanduser(options.eggs))
else:
- VERSION = ''
+ eggs_dir = tempfile.mkdtemp()
+
+if options.setup_source is None:
+ if options.use_distribute:
+ options.setup_source = distribute_source
+ else:
+ options.setup_source = setuptools_source
-USE_DISTRIBUTE = options.distribute
-args = args + ['bootstrap']
+if options.accept_buildout_test_releases:
+ args.append('buildout:accept-buildout-test-releases=true')
+args.append('bootstrap')
-to_reload = False
try:
import pkg_resources
+ import setuptools # A flag. Sometimes pkg_resources is installed alone.
if not hasattr(pkg_resources, '_distribute'):
- to_reload = True
raise ImportError
except ImportError:
+ ez_code = urllib2.urlopen(
+ options.setup_source).read().replace('\r\n', '\n')
ez = {}
- if USE_DISTRIBUTE:
- exec urllib2.urlopen('http://python-distribute.org/distribute_setup.py'
- ).read() in ez
- ez['use_setuptools'](to_dir=tmpeggs, download_delay=0, no_fake=True)
- else:
- exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
- ).read() in ez
- ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
-
- if to_reload:
- reload(pkg_resources)
- else:
- import pkg_resources
-
-if sys.platform == 'win32':
- def quote(c):
- if ' ' in c:
- return '"%s"' % c # work around spawn lamosity on windows
- else:
- return c
-else:
- def quote (c):
- return c
-
-ws = pkg_resources.working_set
-
-if USE_DISTRIBUTE:
- requirement = 'distribute'
-else:
- requirement = 'setuptools'
-
-env = dict(os.environ,
- PYTHONPATH=
- ws.find(pkg_resources.Requirement.parse(requirement)).location
- )
+ exec ez_code in ez
+ setup_args = dict(to_dir=eggs_dir, download_delay=0)
+ if options.download_base:
+ setup_args['download_base'] = options.download_base
+ if options.use_distribute:
+ setup_args['no_fake'] = True
+ ez['use_setuptools'](**setup_args)
+ if 'pkg_resources' in sys.modules:
+ reload(sys.modules['pkg_resources'])
+ import pkg_resources
+ # This does not (always?) update the default working set. We will
+ # do it.
+ for path in sys.path:
+ if path not in pkg_resources.working_set.entries:
+ pkg_resources.working_set.add_entry(path)
cmd = [quote(sys.executable),
'-c',
quote('from setuptools.command.easy_install import main; main()'),
'-mqNxd',
- quote(tmpeggs)]
+ quote(eggs_dir)]
+
+if not has_broken_dash_S:
+ cmd.insert(1, '-S')
+
+find_links = options.download_base
+if not find_links:
+ find_links = os.environ.get('bootstrap-testing-find-links')
+if find_links:
+ cmd.extend(['-f', quote(find_links)])
+
+if options.use_distribute:
+ setup_requirement = 'distribute'
+else:
+ setup_requirement = 'setuptools'
+ws = pkg_resources.working_set
+setup_requirement_path = ws.find(
+ pkg_resources.Requirement.parse(setup_requirement)).location
+env = dict(
+ os.environ,
+ PYTHONPATH=setup_requirement_path)
-if 'bootstrap-testing-find-links' in os.environ:
- cmd.extend(['-f', os.environ['bootstrap-testing-find-links']])
+requirement = 'zc.buildout'
+version = options.version
+if version is None and not options.accept_buildout_test_releases:
+ # Figure out the most recent final version of zc.buildout.
+ import setuptools.package_index
+ _final_parts = '*final-', '*final'
-cmd.append('zc.buildout' + VERSION)
+ def _final_version(parsed_version):
+ for part in parsed_version:
+ if (part[:1] == '*') and (part not in _final_parts):
+ return False
+ return True
+ index = setuptools.package_index.PackageIndex(
+ search_path=[setup_requirement_path])
+ if find_links:
+ index.add_find_links((find_links,))
+ req = pkg_resources.Requirement.parse(requirement)
+ if index.obtain(req) is not None:
+ best = []
+ bestv = None
+ for dist in index[req.project_name]:
+ distv = dist.parsed_version
+ if _final_version(distv):
+ if bestv is None or distv > bestv:
+ best = [dist]
+ bestv = distv
+ elif distv == bestv:
+ best.append(dist)
+ if best:
+ best.sort()
+ version = best[-1].version
+if version:
+ requirement = '=='.join((requirement, version))
+cmd.append(requirement)
if is_jython:
import subprocess
exitcode = subprocess.Popen(cmd, env=env).wait()
-else: # Windows prefers this, apparently; otherwise we would prefer subprocess
+else: # Windows prefers this, apparently; otherwise we would prefer subprocess
exitcode = os.spawnle(*([os.P_WAIT, sys.executable] + cmd + [env]))
-assert exitcode == 0
+if exitcode != 0:
+ sys.stdout.flush()
+ sys.stderr.flush()
+ print ("An error occurred when trying to install zc.buildout. "
+ "Look above this message for any errors that "
+ "were output by easy_install.")
+ sys.exit(exitcode)
-ws.add_entry(tmpeggs)
-ws.require('zc.buildout' + VERSION)
+ws.add_entry(eggs_dir)
+ws.require(requirement)
import zc.buildout.buildout
zc.buildout.buildout.main(args)
-shutil.rmtree(tmpeggs)
+if not options.eggs: # clean up temporary egg directory
+ shutil.rmtree(eggs_dir)
diff --git a/buildout.cfg b/buildout.cfg
index 464de7c..67b6461 100644
--- a/buildout.cfg
+++ b/buildout.cfg
@@ -13,6 +13,7 @@ extensions =
unzip = true
auto-checkout =
github3
+always-checkout = force
develop = .
versions = versions
diff --git a/versions.cfg b/versions.cfg
index bf461b0..a437e74 100644
--- a/versions.cfg
+++ b/versions.cfg
@@ -1,114 +1,42 @@
-[versions]
Chameleon = 2.5.3
Cheetah = 2.2.1
Mako = 0.5.0
MarkupSafe = 0.15
Paste = 1.7.5.1
-WebTest = 1.3.2
-collective.recipe.omelette = 0.12
-distribute = 0.6.24
-ipdb = 0.6.1
-ipython = 0.11
-minitage.paste = 1.3.1856
-minitage.recipe.wsgi = 1.37
-mr.developer = 1.19
-nose = 1.1.2
-venusian = 1.0a2
-zope.component = 3.11.0
-zope.interface = 3.8.0
-
-#Required by:
-#PasteScript 1.7.4.2
PasteDeploy = 1.5.0
-
-#Required by:
-#minitage.paste 1.3.1856
PasteScript = 1.7.4.2
-
-#Required by:
-#WebError 0.10.3
Pygments = 1.4
-
-#Required by:
-#WebError 0.10.3
Tempita = 0.5.1
-
-#Required by:
-#collective.pullrequestreview 0.0
WebError = 0.10.3
-
-#Required by:
-#WebError 0.10.3
-#WebTest 1.3.2
WebOb = 1.2b2
-
-#Required by:
-#minitage.paste 1.3.1856
+WebTest = 1.3.2
+WebTest = 1.3.2
ZopeSkel = 3.0a1
-
-#Required by:
-#mr.developer 1.19
+collective.recipe.omelette = 0.12
+distribute = 0.6.24
elementtree = 1.2.7-20070827-preview
-
-#Required by:
-#minitage.recipe.wsgi 1.37
iniparse = 0.4
-
-#Required by:
-#minitage.recipe.wsgi 1.37
-#minitage.recipe.scripts 1.55
+ipdb = 0.6.1
+ipython = 0.11
minitage.core = 2.0.27
-
-#Required by:
-#minitage.recipe.egg 1.88
+minitage.paste = 1.3.1856
minitage.recipe.common = 1.78
-
-#Required by:
-#minitage.recipe.scripts 1.55
minitage.recipe.egg = 1.88
-
-#Required by:
-#minitage.recipe.wsgi 1.37
minitage.recipe.scripts = 1.55
-
-#Required by:
-#collective.pullrequestreview 0.0
+minitage.recipe.wsgi = 1.37
+mr.developer = 1.19
+nose = 1.1.2
pyramid = 1.2.1
-
-#Required by:
-#pyramid 1.2.1
repoze.lru = 0.4
-
-#Required by:
-#templer.plone 1.0a1
-#templer.zope 1.0a2
-#ZopeSkel 3.0a1
templer.buildout = 1.0a2
-
-#Required by:
-#templer.plone 1.0a1
-#templer.buildout 1.0a2
-#templer.zope 1.0a2
-#ZopeSkel 3.0a1
templer.core = 1.0b3
-
-#Required by:
-#ZopeSkel 3.0a1
templer.plone = 1.0a1
-
-#Required by:
-#templer.plone 1.0a1
-#ZopeSkel 3.0a1
templer.zope = 1.0a2
-
-#Required by:
-#pyramid 1.2.1
translationstring = 0.4
-
-#Required by:
-#pyramid 1.2.1
+venusian = 1.0a2
+zc.buildout = 1.5.2
+zc.recipe.egg = 1.3.2
+zope.component = 3.11.0
zope.deprecation = 3.5.0
-
-#Required by:
-#zope.component 3.11.0
zope.event = 3.5.1
+zope.interface = 3.8.0
--
1.7.5.4
From 79142fb617af3e7fa7e5f954cdb810847093a1ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Roche?= <jfroche@affinitic.be>
Date: Mon, 7 Nov 2011 12:09:56 -0800
Subject: [PATCH 2/6] add script for hooks
---
buildout.cfg | 16 ++++++++-
collectivepullrequestreview/scripts/addHook.py | 37 ++++++++++++++++++++++
collectivepullrequestreview/scripts/listHooks.py | 31 ++++++++++++++++++
collectivepullrequestreview/scripts/testHook.py | 34 ++++++++++++++++++++
setup.py | 11 ++++--
5 files changed, 123 insertions(+), 6 deletions(-)
create mode 100644 collectivepullrequestreview/scripts/__init__.py
create mode 100644 collectivepullrequestreview/scripts/addHook.py
create mode 100644 collectivepullrequestreview/scripts/listHooks.py
create mode 100644 collectivepullrequestreview/scripts/testHook.py
diff --git a/buildout.cfg b/buildout.cfg
index 464de7c..b9cf5ce 100644
--- a/buildout.cfg
+++ b/buildout.cfg
@@ -1,23 +1,26 @@
[buildout]
extends = versions.cfg
-index = http://d.pypi.python.org/simple
parts =
pyramid
wsgi
+ scripts
omelette
test
+ py
eggs =
extensions =
mr.developer
buildout.dumppickedversions
unzip = true
auto-checkout =
- github3
+ github
+# github3
develop = .
versions = versions
[sources]
github3 = git git://github.com/kennethreitz/python-github3.git
+github = git https://github.com/dustin/py-github.git
[omelette]
recipe = collective.recipe.omelette
@@ -46,3 +49,12 @@ scripts =
recipe = minitage.recipe.wsgi
config-file = ${buildout:directory}/production.ini
eggs = collective.pullrequestreview
+
+[py]
+recipe = zc.recipe.egg
+eggs = collective.pullrequestreview
+interpreter = py
+
+[scripts]
+recipe = zc.recipe.egg:scripts
+eggs = collective.pullrequestreview
diff --git a/collectivepullrequestreview/scripts/__init__.py b/collectivepullrequestreview/scripts/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/collectivepullrequestreview/scripts/addHook.py b/collectivepullrequestreview/scripts/addHook.py
new file mode 100644
index 0000000..afb8f4a
--- /dev/null
+++ b/collectivepullrequestreview/scripts/addHook.py
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+from optparse import OptionParser
+
+
+def getOptions():
+ parser = OptionParser()
+ parser.add_option("-u", "--user", dest="user",
+ help="user needed to connect", metavar="USER")
+ parser.add_option("-p", "--password", dest="password",
+ help="password needed to connect", metavar="PASSWORD")
+ parser.add_option("-U", "--repouser", dest="repouser",
+ help="user where the repository stands", metavar="REPOUSER")
+ parser.add_option("-r", "--repo", dest="repo",
+ help="user where the repository stands", metavar="REPO")
+ parser.add_option("-o", "--urltonotify", dest="url",
+ help="url to notify with new pull request", metavar="URL")
+ (options, args) = parser.parse_args()
+ if options.user is None or\
+ options.password is None or\
+ options.repouser is None or\
+ options.repo is None or\
+ options.url is None:
+ parser.error("wrong number of arguments")
+ return options
+
+
+def main():
+ options = getOptions()
+ from github import github
+ gh = github.GitHub(options.user, options.password)
+ gh.repos.createHook(options.repouser, options.repo, 'web',
+ config=dict(url=options.url, content_type='json'),
+ events=['pull_request', 'push'])
+ print gh.repos.listHooks(options.repouser, options.repo)
+
+if __name__ == '__main__':
+ main()
diff --git a/collectivepullrequestreview/scripts/listHooks.py b/collectivepullrequestreview/scripts/listHooks.py
new file mode 100644
index 0000000..83c10ab
--- /dev/null
+++ b/collectivepullrequestreview/scripts/listHooks.py
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+from optparse import OptionParser
+
+
+def getOptions():
+ parser = OptionParser()
+ parser.add_option("-u", "--user", dest="user",
+ help="user needed to connect", metavar="USER")
+ parser.add_option("-p", "--password", dest="password",
+ help="password needed to connect", metavar="PASSWORD")
+ parser.add_option("-U", "--repouser", dest="repouser",
+ help="user where the repository stands", metavar="REPOUSER")
+ parser.add_option("-r", "--repo", dest="repo",
+ help="user where the repository stands", metavar="REPO")
+ (options, args) = parser.parse_args()
+ if options.user is None or\
+ options.password is None or\
+ options.repouser is None or\
+ options.repo is None:
+ parser.error("wrong number of arguments")
+ return options
+
+
+def main():
+ options = getOptions()
+ from github import github
+ gh = github.GitHub(options.user, options.password)
+ print gh.repos.listHooks(options.repouser, options.repo)
+
+if __name__ == '__main__':
+ main()
diff --git a/collectivepullrequestreview/scripts/testHook.py b/collectivepullrequestreview/scripts/testHook.py
new file mode 100644
index 0000000..d76cebc
--- /dev/null
+++ b/collectivepullrequestreview/scripts/testHook.py
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+from optparse import OptionParser
+
+
+def getOptions():
+ parser = OptionParser()
+ parser.add_option("-u", "--user", dest="user",
+ help="user needed to connect", metavar="USER")
+ parser.add_option("-p", "--password", dest="password",
+ help="password needed to connect", metavar="PASSWORD")
+ parser.add_option("-U", "--repouser", dest="repouser",
+ help="user where the repository stands", metavar="REPOUSER")
+ parser.add_option("-r", "--repo", dest="repo",
+ help="user where the repository stands", metavar="REPO")
+ parser.add_option("-i", "--hookid", dest="hookid",
+ help="the hook id to be tested", metavar="HOOKID")
+ (options, args) = parser.parse_args()
+ if options.user is None or\
+ options.password is None or\
+ options.repouser is None or\
+ options.repo is None or\
+ options.hookid is None:
+ parser.error("wrong number of arguments")
+ return options
+
+
+def main():
+ options = getOptions()
+ from github import github
+ gh = github.GitHub(options.user, options.password)
+ gh.repos.testHook(options.repouser, options.repo, options.hookid)
+
+if __name__ == '__main__':
+ main()
diff --git a/setup.py b/setup.py
index 2733be8..0d2fa79 100644
--- a/setup.py
+++ b/setup.py
@@ -6,12 +6,12 @@ here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.txt')).read()
CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
-requires = ['pyramid', 'WebError']
+requires = ['pyramid', 'WebError', 'github']
setup(name='collective.pullrequestreview',
version='0.0',
description='collective.pullrequestreview',
- long_description=README + '\n\n' + CHANGES,
+ long_description=README + '\n\n' + CHANGES,
classifiers=[
"Programming Language :: Python",
"Framework :: Pylons",
@@ -28,10 +28,13 @@ setup(name='collective.pullrequestreview',
install_requires=requires,
tests_require=requires,
test_suite="collectivepullrequestreview",
- entry_points = """\
+ entry_points="""\
[paste.app_factory]
main = collectivepullrequestreview:main
+ [console_scripts]
+ listHooks = collectivepullrequestreview.scripts.listHooks:main
+ addHook = collectivepullrequestreview.scripts.addHook:main
+ testHook = collectivepullrequestreview.scripts.testHook:main
""",
paster_plugins=['pyramid'],
)
-
--
1.7.5.4
From 6bec636ad351022a72020722debe4abfb53c7c03 Mon Sep 17 00:00:00 2001
From: Vincent Fretin <vincent.fretin@gmail.com>
Date: Mon, 7 Nov 2011 20:15:39 +0100
Subject: [PATCH 3/6] fixed versions.cfg
---
versions.cfg | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/versions.cfg b/versions.cfg
index a437e74..1829c0a 100644
--- a/versions.cfg
+++ b/versions.cfg
@@ -1,3 +1,4 @@
+[versions]
Chameleon = 2.5.3
Cheetah = 2.2.1
Mako = 0.5.0
--
1.7.5.4
From db73a08da9e61c7b4bf3f8ab6e9a3023ef979c09 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Roche?= <jfroche@affinitic.be>
Date: Mon, 7 Nov 2011 11:31:00 -0800
Subject: [PATCH 4/6] remove script section
---
buildout.cfg | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/buildout.cfg b/buildout.cfg
index 2d70c79..7b5a35a 100644
--- a/buildout.cfg
+++ b/buildout.cfg
@@ -3,7 +3,6 @@ extends = versions.cfg
parts =
pyramid
wsgi
- scripts
omelette
test
py
@@ -55,7 +54,3 @@ eggs = collective.pullrequestreview
recipe = zc.recipe.egg
eggs = collective.pullrequestreview
interpreter = py
-
-[scripts]
-recipe = zc.recipe.egg:scripts
-eggs = collective.pullrequestreview
--
1.7.5.4
From 176a8a168e64d160deb28087d48f1e021231eea6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Roche?= <jfroche@affinitic.be>
Date: Mon, 7 Nov 2011 11:53:41 -0800
Subject: [PATCH 5/6] remove comment
---
buildout.cfg | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/buildout.cfg b/buildout.cfg
index 7b5a35a..bb5082d 100644
--- a/buildout.cfg
+++ b/buildout.cfg
@@ -41,7 +41,6 @@ initialization = import os; os.chdir('${buildout:directory}')
eggs =
nose
ipdb
-# collective.pullrequestreview[test]
scripts =
nosetests=test
--
1.7.5.4
From eca058b672bcddfdb9f848b29b39e1d2c9c2f98a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Roche?= <jfroche@affinitic.be>
Date: Mon, 7 Nov 2011 12:18:18 -0800
Subject: [PATCH 6/6] fix test
---
buildout.cfg | 1 +
setup.cfg | 3 ---
2 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/buildout.cfg b/buildout.cfg
index bb5082d..479a521 100644
--- a/buildout.cfg
+++ b/buildout.cfg
@@ -39,6 +39,7 @@ interpreter = py
recipe = zc.recipe.egg
initialization = import os; os.chdir('${buildout:directory}')
eggs =
+ collective.pullrequestreview
nose
ipdb
scripts =
diff --git a/setup.cfg b/setup.cfg
index e0d734e..e50ae91 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,9 +1,6 @@
[nosetests]
match = ^test
nocapture = 1
-cover-package = collectivepullrequestreview
-with-coverage = 1
-cover-erase = 1
[compile_catalog]
directory = collectivepullrequestreview/locale
--
1.7.5.4