Skip to content

Commit 8466be8

Browse files
committed
vobject/__init__.py's VERSION is now canonical.
setup.py uses that, and the change_tz and ics_diff tools report it.
1 parent 209b6b9 commit 8466be8

File tree

5 files changed

+23
-19
lines changed

5 files changed

+23
-19
lines changed

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[metadata]
2+
version = attr: vobject.VERSION

setup.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,18 @@
2828
doclines = (__doc__ or '').splitlines()
2929

3030
setup(name = "vobject",
31-
version = "0.9.7",
3231
author = "Jeffrey Harris",
3332
author_email = "jeffrey@osafoundation.org",
3433
maintainer = "David Arnold",
3534
maintainer_email="davida@pobox.com",
3635
license = "Apache",
3736
zip_safe = True,
38-
url = "http://py-vobject.github.io/",
39-
download_url = 'https://github.com/py-vobject/vobject/releases',
40-
bugtrack_url = "https://github.com/py-vobject/vobject/issues",
37+
project_urls = {
38+
"Home": "http://py-vobject.github.io/",
39+
"GitHub": "https://github.com/py-vobject/vobject",
40+
"Download": "https://github.com/py-vobject/vobject/releases",
41+
"Issues": "https://github.com/py-vobject/vobject/issues",
42+
},
4143
entry_points = {
4244
'console_scripts': [
4345
'ics_diff = vobject.ics_diff:main',

vobject/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@
8080
from . import icalendar, vcard
8181

8282

83+
# Package version
84+
VERSION = "0.9.8"
85+
86+
8387
def iCalendar():
8488
return newFromBehavior('vcalendar', '2.0')
8589

vobject/change_tz.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Translate an ics file's events to a different timezone."""
22

33
from optparse import OptionParser
4-
from vobject import icalendar, base
4+
import vobject
55

66
try:
77
import PyICU
@@ -11,7 +11,7 @@
1111
from datetime import datetime
1212

1313

14-
def change_tz(cal, new_timezone, default, utc_only=False, utc_tz=icalendar.utc):
14+
def change_tz(cal, new_timezone, default, utc_only=False, utc_tz=vobject.icalendar.utc):
1515
"""
1616
Change the timezone of the specified component.
1717
@@ -58,7 +58,7 @@ def main():
5858
else:
5959
timezone = PyICU.ICUtzinfo.default
6060
print("... Reading {0!s}".format(ics_file))
61-
cal = base.readOne(open(ics_file))
61+
cal = vobject.readOne(open(ics_file))
6262
change_tz(cal, timezone, PyICU.ICUtzinfo.default, utc_only)
6363

6464
out_name = ics_file + '.converted'
@@ -70,14 +70,11 @@ def main():
7070
print("Done")
7171

7272

73-
version = "0.1"
74-
75-
7673
def get_options():
7774
# Configuration options
7875

7976
usage = """usage: %prog [options] ics_file [timezone]"""
80-
parser = OptionParser(usage=usage, version=version)
77+
parser = OptionParser(usage=usage, version=vobject.VERSION)
8178
parser.set_description("change_tz will convert the timezones in an ics file. ")
8279

8380
parser.add_option("-u", "--only-utc", dest="utc", action="store_true",

vobject/ics_diff.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
from optparse import OptionParser
44

5-
from .base import Component, getBehavior, newFromBehavior, readOne
5+
import vobject
6+
67

78
"""
89
Compare VTODOs and VEVENTs in two iCalendar sources.
@@ -98,8 +99,8 @@ def newComponent(name, body):
9899
if body is None:
99100
return None
100101
else:
101-
c = Component(name)
102-
c.behavior = getBehavior(name)
102+
c = vobject.base.Component(name)
103+
c.behavior = vobject.base.getBehavior(name)
103104
c.isNative = True
104105
return c
105106

@@ -117,7 +118,7 @@ def processComponentPair(leftComp, rightComp):
117118

118119
for key in leftChildKeys:
119120
rightList = rightComp.contents.get(key, [])
120-
if isinstance(leftComp.contents[key][0], Component):
121+
if isinstance(leftComp.contents[key][0], vobject.base.Component):
121122
compDifference = processComponentLists(leftComp.contents[key],
122123
rightList)
123124
if len(compDifference) > 0:
@@ -129,7 +130,7 @@ def processComponentPair(leftComp, rightComp):
129130

130131
for key in rightChildKeys:
131132
if key not in leftChildKeys:
132-
if isinstance(rightComp.contents[key][0], Component):
133+
if isinstance(rightComp.contents[key][0], vobject.base.Component):
133134
differentComponents[key] = ([], rightComp.contents[key])
134135
else:
135136
differentContentLines.append(([], rightComp.contents[key]))
@@ -198,14 +199,12 @@ def main():
198199
deleteExtraneous(cal2, ignore_dtstamp=ignore_dtstamp)
199200
prettyDiff(cal1, cal2)
200201

201-
version = "0.1"
202-
203202

204203
def getOptions():
205204
##### Configuration options #####
206205

207206
usage = "usage: %prog [options] ics_file1 ics_file2"
208-
parser = OptionParser(usage=usage, version=version)
207+
parser = OptionParser(usage=usage, version=vobject.VERSION)
209208
parser.set_description("ics_diff will print a comparison of two iCalendar files ")
210209

211210
parser.add_option("-i", "--ignore-dtstamp", dest="ignore", action="store_true",

0 commit comments

Comments
 (0)