Skip to content

Commit

Permalink
Merge pull request #44 from da4089/dev-version
Browse files Browse the repository at this point in the history
Automate version
  • Loading branch information
da4089 authored Apr 9, 2024
2 parents 37b0a73 + 5109fbc commit b5400b4
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 14 deletions.
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[metadata]
version = attr: vobject.VERSION
10 changes: 6 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,18 @@
doclines = (__doc__ or '').splitlines()

setup(name = "vobject",
version = "0.9.7",
author = "Jeffrey Harris",
author_email = "jeffrey@osafoundation.org",
maintainer = "David Arnold",
maintainer_email="davida@pobox.com",
license = "Apache",
zip_safe = True,
url = "http://py-vobject.github.io/",
download_url = 'https://github.com/py-vobject/vobject/releases',
bugtrack_url = "https://github.com/py-vobject/vobject/issues",
project_urls = {
"Home": "http://py-vobject.github.io/",
"GitHub": "https://github.com/py-vobject/vobject",
"Download": "https://github.com/py-vobject/vobject/releases",
"Issues": "https://github.com/py-vobject/vobject/issues",
},
entry_points = {
'console_scripts': [
'ics_diff = vobject.ics_diff:main',
Expand Down
4 changes: 4 additions & 0 deletions vobject/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@
from . import icalendar, vcard


# Package version
VERSION = "0.9.8"


def iCalendar():
return newFromBehavior('vcalendar', '2.0')

Expand Down
40 changes: 38 additions & 2 deletions vobject/change_tz.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
"""Translate an ics file's events to a different timezone."""

<<<<<<< HEAD
from optparse import OptionParser
import vobject

try:
import PyICU
except:
PyICU = None

=======
>>>>>>> master
from datetime import datetime
from optparse import OptionParser

Expand All @@ -11,7 +22,7 @@
version = "0.1"


def change_tz(cal, new_timezone, default, utc_only=False, utc_tz=icalendar.utc):
def change_tz(cal, new_timezone, default, utc_only=False, utc_tz=vobject.icalendar.utc):
"""
Change the timezone of the specified component.
Expand Down Expand Up @@ -63,13 +74,38 @@ def main():
if options.list:
show_timezones()
elif args:
<<<<<<< HEAD
utc_only = options.utc
if utc_only:
which = "only UTC"
else:
which = "all"
print("Converting {0!s} events".format(which))
ics_file = args[0]
if len(args) > 1:
timezone = PyICU.ICUtzinfo.getInstance(args[1])
else:
timezone = PyICU.ICUtzinfo.default
print("... Reading {0!s}".format(ics_file))
cal = vobject.readOne(open(ics_file))
change_tz(cal, timezone, PyICU.ICUtzinfo.default, utc_only)

out_name = ics_file + '.converted'
print("... Writing {0!s}".format(out_name))

with open(out_name, 'wb') as out:
cal.serialize(out)

print("Done")
=======
convert_events(utc_only=options.utc, args=args)
>>>>>>> master


def get_options():
# Configuration options
usage = """usage: %prog [options] ics_file [timezone]"""
parser = OptionParser(usage=usage, version=version)
parser = OptionParser(usage=usage, version=vobject.VERSION)
parser.set_description("change_tz will convert the timezones in an ics file. ")

parser.add_option("-u", "--only-utc", dest="utc", action="store_true",
Expand Down
15 changes: 7 additions & 8 deletions vobject/ics_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

from optparse import OptionParser

from .base import Component, getBehavior, newFromBehavior, readOne
import vobject


"""
Compare VTODOs and VEVENTs in two iCalendar sources.
Expand Down Expand Up @@ -98,8 +99,8 @@ def newComponent(name, body):
if body is None:
return None
else:
c = Component(name)
c.behavior = getBehavior(name)
c = vobject.base.Component(name)
c.behavior = vobject.base.getBehavior(name)
c.isNative = True
return c

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

for key in leftChildKeys:
rightList = rightComp.contents.get(key, [])
if isinstance(leftComp.contents[key][0], Component):
if isinstance(leftComp.contents[key][0], vobject.base.Component):
compDifference = processComponentLists(leftComp.contents[key],
rightList)
if len(compDifference) > 0:
Expand All @@ -129,7 +130,7 @@ def processComponentPair(leftComp, rightComp):

for key in rightChildKeys:
if key not in leftChildKeys:
if isinstance(rightComp.contents[key][0], Component):
if isinstance(rightComp.contents[key][0], vobject.base.Component):
differentComponents[key] = ([], rightComp.contents[key])
else:
differentContentLines.append(([], rightComp.contents[key]))
Expand Down Expand Up @@ -198,14 +199,12 @@ def main():
deleteExtraneous(cal2, ignore_dtstamp=ignore_dtstamp)
prettyDiff(cal1, cal2)

version = "0.1"


def getOptions():
##### Configuration options #####

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

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

0 comments on commit b5400b4

Please sign in to comment.