diff -Nru dex-0.7/CHANGELOG.md dex-0.8.0/CHANGELOG.md --- dex-0.7/CHANGELOG.md 1970-01-01 00:00:00.000000000 +0000 +++ dex-0.8.0/CHANGELOG.md 2017-06-18 09:03:00.000000000 +0000 @@ -0,0 +1,22 @@ +# Change Log +All notable changes to this project will be documented in this file. + +## [0.8.0] - 2017-06-18 +### Added +- Add -s switch to specify the search paths (thanks to Johannes Löthberg) +- Add support for KDE's proprietary Service type (#7 and #28, thanks to + Sébastien Luttringer and Konfekt) + +### Changed +- Mark clean target PHONY +- Switch to RST for the README and manpaeg +- Ignore backslash in comments (#8, thanks to nanouck) +- Ignore missing name for Type=Service entries (#28, thanks to Konfekt) + +### Fixed +- add force to clean target (#25, thanks to Johannes Löthberg) +- Turn utf-8 string into Unicode string literal (#23, thanks to Johannes + Löthberg) +- Fix error converting man page +- Print nice error message when target directory doesn't exist (#31, thanks to + @lasers) diff -Nru dex-0.7/debian/changelog dex-0.8.0/debian/changelog --- dex-0.7/debian/changelog 2015-12-30 18:17:03.000000000 +0000 +++ dex-0.8.0/debian/changelog 2017-06-23 02:12:41.000000000 +0000 @@ -1,3 +1,14 @@ +dex (0.8.0-1) unstable; urgency=medium + + [ upstream ] + * Support Service type desktop files + + [ James McCoy ] + * Build-Depend on python3-sphinx to build the man page. + * Declare compliance with policy 4.0.0, no changes needed. + + -- James McCoy Thu, 22 Jun 2017 22:12:41 -0400 + dex (0.7-2) unstable; urgency=medium [ Scott Kitterman ] diff -Nru dex-0.7/debian/control dex-0.8.0/debian/control --- dex-0.7/debian/control 2015-12-30 18:17:03.000000000 +0000 +++ dex-0.8.0/debian/control 2017-06-23 02:12:41.000000000 +0000 @@ -1,8 +1,12 @@ Source: dex Priority: extra Maintainer: James McCoy -Build-Depends: debhelper (>= 9), python3, dh-python -Standards-Version: 3.9.6 +Build-Depends: + debhelper (>= 9), + dh-python, + python3, + python3-sphinx +Standards-Version: 4.0.0 Section: x11 Homepage: https://github.com/jceb/dex Vcs-Git: https://anonscm.debian.org/git/collab-maint/dex.git diff -Nru dex-0.7/debian/rules dex-0.8.0/debian/rules --- dex-0.7/debian/rules 2015-12-30 18:17:03.000000000 +0000 +++ dex-0.8.0/debian/rules 2017-06-23 02:12:41.000000000 +0000 @@ -5,9 +5,9 @@ %: dh $@ --with python3 -# Nothing to build or clean -override_dh_auto_build override_dh_auto_clean: +override_dh_auto_build: + $(MAKE) VERSION=$(DEB_VERSION_UPSTREAM) override_dh_auto_install-indep: - $(MAKE) install VERSION=$(UPSTREAM_VERSION) PREFIX=/usr DESTDIR=$(CURDIR)/debian/dex MANPREFIX='$${PREFIX}/share/man' - rm -f $(CURDIR)/debian/dex/usr/share/doc/dex/LICENSE + $(MAKE) install PREFIX=/usr DESTDIR=$(CURDIR)/debian/dex MANPREFIX='$${PREFIX}/share/man' + rm -f $(CURDIR)/debian/dex/usr/share/doc/dex/LICENSE $(CURDIR)/debian/dex/usr/share/doc/dex/README.rst diff -Nru dex-0.7/dex dex-0.8.0/dex --- dex-0.7/dex 2013-11-13 21:43:01.000000000 +0000 +++ dex-0.8.0/dex 2017-06-18 09:03:00.000000000 +0000 @@ -171,9 +171,11 @@ if grp_desktopentry not in self.groups: raise DesktopEntryTypeException("'%s' is not a valid Desktop Entry group is missing." % (self.filename, )) if not (self.Type and self.Name): - raise DesktopEntryTypeException("'%s' is not a valid Desktop Entry because Type or Name keys are missing." % (self.filename, )) + if self.Type != 'Service': + # allow files with type Service and no Name + raise DesktopEntryTypeException("'%s' is not a valid Desktop Entry because Type or Name keys are missing." % (self.filename, )) _type = self.Type - if _type == 'Application': + if _type in ('Application', 'Service'): if not self.Exec: raise DesktopEntryTypeException("'%s' is not a valid Desktop Entry of type '%s' because Exec is missing." % (self.filename, _type)) elif _type == 'Link': @@ -342,7 +344,7 @@ filename = os.path.join(os.getcwd(), filename) super(Application, self).__init__(filename) self._basename = os.path.basename(filename) - if self.Type != 'Application': + if self.Type not in ('Application', 'Service'): raise DesktopEntryTypeException("'%s' is not of type 'Application'." % self.filename) def __cmp__(self, y): @@ -477,8 +479,9 @@ continue elif c == '\\': - in_esc = True - continue + if not in_quote: + in_esc = True + continue elif c == '%' and not (in_quote or in_singlequote): in_fieldcode = True @@ -571,22 +574,27 @@ """ autostart_directories = [] # autostart directories, ordered by preference - # generate list of autostart directories - if os.environ.get('XDG_CONFIG_HOME', None): - autostart_directories.append(os.path.join(os.environ.get('XDG_CONFIG_HOME'), 'autostart')) - else: - autostart_directories.append(os.path.join(os.environ['HOME'], '.config', 'autostart')) - - if os.environ.get('XDG_CONFIG_DIRS', None): - for d in os.environ['XDG_CONFIG_DIRS'].split(os.pathsep): - if not d: - continue - autostart_dir = os.path.join(d, 'autostart') - if autostart_dir not in autostart_directories: - autostart_directories.append(autostart_dir) + if args.searchpaths: + for p in args.searchpaths[0].split(os.pathsep): + path = os.path.expanduser(p) + path = os.path.expandvars(path) + autostart_directories += [path] else: - autostart_directories.append(os.path.sep + os.path.join('etc', 'xdg', 'autostart')) + # generate list of autostart directories + if os.environ.get('XDG_CONFIG_HOME', None): + autostart_directories.append(os.path.join(os.environ.get('XDG_CONFIG_HOME'), 'autostart')) + else: + autostart_directories.append(os.path.join(os.environ['HOME'], '.config', 'autostart')) + if os.environ.get('XDG_CONFIG_DIRS', None): + for d in os.environ['XDG_CONFIG_DIRS'].split(os.pathsep): + if not d: + continue + autostart_dir = os.path.join(d, 'autostart') + if autostart_dir not in autostart_directories: + autostart_directories.append(autostart_dir) + else: + autostart_directories.append(os.path.sep + os.path.join('etc', 'xdg', 'autostart')) return autostart_directories @@ -732,7 +740,12 @@ if args.verbose: print('Output: %s' % output) - targetfile = sys.stdout if output == '-' else open(output, 'w') + + try: + targetfile = sys.stdout if output == '-' else open(output, 'w') + except FileNotFoundError: + print('Target directory does not exist: %s' % os.path.dirname(output)) + return 1 de.write(targetfile) if args.targetdir and len(args.create) > 1: @@ -755,6 +768,7 @@ run.add_argument("-a", "--autostart", action="store_true", dest="autostart", help="autostart programs") run.add_argument("-d", "--dry-run", action="store_true", dest="dryrun", help="dry run, don't execute any command") run.add_argument("-e", "--environment", nargs=1, dest="environment", help="specify the Desktop Environment an autostart should be performed for; works only in combination with --autostart") + run.add_argument("-s", "--search-paths", nargs=1, dest="searchpaths", help="colon separated list of paths to search for desktop files, overriding the default search list") create = parser.add_argument_group('create') create.add_argument("-c", "--create", nargs='+', dest="create", help="create a DesktopEntry file for the given program. If a second argument is provided it's taken as output filename or written to stdout (filname: -). By default a new file with the postfix .desktop is created") diff -Nru dex-0.7/dex.1 dex-0.8.0/dex.1 --- dex-0.7/dex.1 2013-11-13 21:43:01.000000000 +0000 +++ dex-0.8.0/dex.1 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -.TH DEX 1 dex\-VERSION -.SH NAME -dex \- DesktopEntry Execution -.SH SYNOPSIS -.B dex -.RB [options]\ [DesktopEntryFile\ [DesktopEntryFile ...]] -.SH DESCRIPTION -dex, DesktopEntry Execution, is a program to generate and execute -DesktopEntry files of the type Application. -.SH OPTIONS -.TP -.B \-h, \-\-help -show this help message and exit -.TP -.B \-a, \-\-autostart -autostart programs -.TP -.B \-c CREATE [CREATE ...], \-\-create CREATE [CREATE ...] -create a DesktopEntry file for the given program. If a second argument -is provided it's taken as output filename or written to stdout (filname: -\-). By default a new file with the postfix .desktop is created -.TP -.B \-d, \-\-dry\-run -dry run, don't execute any command -.TP -.B \-e ENVIRONMENT, \-\-environment ENVIRONMENT -specify the Desktop Environment an autostart should be performed for; -works only in combination with \-\-autostart -.TP -.B \-t, \-\-target-directroy DIRECTORY -create files in target directory -.TP -.B \-\-test -perform a self\-test -.TP -.B \-v, \-\-verbose -verbose output -.TP -.B \-V, \-\-version -display version information -.SH EXAMPLES -.TP -Perform an autostart/execute all programs in the autostart folders. -.B dex -a -.TP -Preview the programs would be executed in a regular autostart. -.B dex -ad -.TP -Preview the programs would be executed in a GNOME specific autostart. -.B dex -ad -e GNOME -.TP -Create a DesktopEntry for a program in the current directory. -.B dex -c /usr/bin/skype -.TP -Create a DesktopEntry for a programs in autostart directroy. -.B dex -t ~/.config/autostart -c /usr/bin/skype /usr/bin/nm-applet -.TP -Execute a single program from command line and enable verbose output. -.B dex -v skype.desktop diff -Nru dex-0.7/Makefile dex-0.8.0/Makefile --- dex-0.7/Makefile 2013-11-13 21:43:01.000000000 +0000 +++ dex-0.8.0/Makefile 2017-06-18 09:03:00.000000000 +0000 @@ -3,25 +3,28 @@ DOCPREFIX = $(PREFIX)/share/doc/$(NAME) MANPREFIX = $(PREFIX)/man VERSION = $(shell git tag | tail -n 1) -TAG = dex-$(VERSION) +TAG = $(NAME)-$(VERSION) -build: +build: dex.1 -install: dex dex.1 README LICENSE +dex.1: man/dex.rst + @echo building the manpage in man/ + @sphinx-build -b man -D version=$(TAG) -E man . $+ + +install: dex dex.1 README.rst LICENSE @echo installing executable file to $(DESTDIR)$(PREFIX)/bin @mkdir -p $(DESTDIR)$(PREFIX)/bin - @install -m 0755 $< $(DESTDIR)$(PREFIX)/bin/ + @install -m 0755 $< $(DESTDIR)$(PREFIX)/bin/$(NAME) @echo installing docs to $(DESTDIR)$(DOCPREFIX) @mkdir -p $(DESTDIR)$(DOCPREFIX) - @install -m 0644 -t $(DESTDIR)$(DOCPREFIX)/ README LICENSE + @install -m 0644 -t $(DESTDIR)$(DOCPREFIX)/ README.rst LICENSE @echo installing manual page to $(DESTDIR)$(MANPREFIX)/man1 @mkdir -p $(DESTDIR)$(MANPREFIX)/man1 - @install -m 0644 -t $(DESTDIR)$(MANPREFIX)/man1 dex.1 - @sed -i -e "s/VERSION/$(VERSION)/g" $(DESTDIR)$(MANPREFIX)/man1/dex.1 + @install -m 0644 dex.1 $(DESTDIR)$(MANPREFIX)/man1/$(NAME).1 tgz: source -source: dex dex.1 README LICENSE Makefile +source: dex dex.1 README.rst LICENSE Makefile CHANGELOG.md @echo "Creating source package: $(TAG).tar.gz" @mkdir $(TAG) @cp -t $(TAG) $+ @@ -29,6 +32,7 @@ @rm -rf $(TAG) clean: - @rm $(TAG).tar.gz + @rm -f $(TAG).tar.gz + @rm -f dex.1 -.PHONY: build install tgz source +.PHONY: build install tgz source clean diff -Nru dex-0.7/man/conf.py dex-0.8.0/man/conf.py --- dex-0.7/man/conf.py 1970-01-01 00:00:00.000000000 +0000 +++ dex-0.8.0/man/conf.py 2017-06-18 09:03:00.000000000 +0000 @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +import sys +import os + +project = 'dex' +master_doc = 'dex' +source_suffix = '.rst' + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ('dex', 'dex', 'DesktopEntry Execution', + ['Jan Christoph Ebersbach', u'Johannes Löthberg'], 1) +] diff -Nru dex-0.7/man/dex.rst dex-0.8.0/man/dex.rst --- dex-0.7/man/dex.rst 1970-01-01 00:00:00.000000000 +0000 +++ dex-0.8.0/man/dex.rst 2017-06-18 09:03:00.000000000 +0000 @@ -0,0 +1,76 @@ +dex +=== + +Synopsis +-------- + +**dex** [*options*] [*DesktopEntryFile*]... + +Description +----------- + +:program:`dex`, DesktopEntry Execution, is a program to generate and execute DesktopEntry files of the Application type. + +Options +------- + +-h, --help + Show this help message and exit + +-a, --autostart + Autostart programs + +-c PATH, --create PATH + Create a DesktopEntry file for the program at the given path. An optional second argument is used to specify the filename of the created DesktopEntry file, or specify the filename - to print the file to stdout. By default a new file is created with the .desktop file extension. + +-d, --dry-run + Dry run, don't execute any command + +-e ENVIRONMENT, --environment ENVIRONMENT + Specify the Desktop Environment an autostart should be performed for; works only in combination with --autostart + +-s SEARCHPATHS, --search-paths SEARCHPATHS + Colon separated list of paths to search for desktop files, overriding the default search list + +-t DIRECTORY, --target-directory DIRECTORY + Create files in target directory + +--test + Perform a self-test + +-v, --verbose + Verbose output + +-V, --version + Display version information + +Examples +-------- + +Perform an autostart/execute all programs in the autostart folders. + + :program:`dex -a` + +Perform an autostart/execute all programs in the specified folders. + + :program:`dex -a -s /etc/xdg/autostart/:~/.config/autostart/` + +Preview the programs would be executed in a regular autostart. + + :program:`dex -ad` + +Preview the programs would be executed in a GNOME specific autostart. + + :program:`dex -ad -e GNOME` + +Create a DesktopEntry for a program in the current directory. + + :program:`dex -c /usr/bin/skype` + +Create a DesktopEntry for a programs in autostart directory. + + :program:`dex -t ~/.config/autostart -c /usr/bin/skype /usr/bin/nm-applet` + +Execute a single program from command line and enable verbose output. + + :program:`dex -v skype.desktop` diff -Nru dex-0.7/README dex-0.8.0/README --- dex-0.7/README 2013-11-13 21:43:01.000000000 +0000 +++ dex-0.8.0/README 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -usage: dex [options] [DesktopEntryFile [DesktopEntryFile ...]] - -dex, DesktopEntry Execution, is a program to generate and execute DesktopEntry -files of the type Application - -positional arguments: - files DesktopEntry files - -optional arguments: - -h, --help show this help message and exit - --test perform a self-test - -v, --verbose verbose output - -V, --version display version information - -run: - -a, --autostart autostart programs - -d, --dry-run dry run, don't execute any command - -e ENVIRONMENT, --environment ENVIRONMENT - specify the Desktop Environment an autostart should be - performed for; works only in combination with - --autostart - -create: - -c CREATE [CREATE ...], --create CREATE [CREATE ...] - create a DesktopEntry file for the given program. If a - second argument is provided it's taken as output - filename or written to stdout (filname: -). By default - a new file with the postfix .desktop is created - -t TARGETDIR, --target-directory TARGETDIR - create files in target directory - -Example usage: list autostart programs: dex -ad - -Examples: -Perform an autostart/execute all programs in the autostart folders. - dex -a - -Preview the programs would be executed in a regular autostart. - dex -ad - -Preview the programs would be executed in a GNOME specific autostart. - dex -ad -e GNOME - -Create a DesktopEntry for a program in the current directory. - dex -c /usr/bin/skype - -Create a DesktopEntry for a programs in autostart directroy. - dex -t ~/.config/autostart -c /usr/bin/skype /usr/bin/nm-applet - -Execute a single program from command line and enable verbose output. - dex -v skype.desktop diff -Nru dex-0.7/README.rst dex-0.8.0/README.rst --- dex-0.7/README.rst 1970-01-01 00:00:00.000000000 +0000 +++ dex-0.8.0/README.rst 2017-06-18 09:03:00.000000000 +0000 @@ -0,0 +1,76 @@ +dex +=== + +Synopsis +-------- + +**dex** [*options*] [*DesktopEntryFile*]... + +Description +----------- + +``dex``, DesktopEntry Execution, is a program to generate and execute DesktopEntry files of the Application type. + +Options +------- + ++------------------------------------+------------------------------------------------------------+ +| Option | Description | ++====================================+============================================================+ +| -h, --help | Show a help message and exit | ++------------------------------------+------------------------------------------------------------+ +| -a, --autostart | Autostart programs | ++------------------------------------+------------------------------------------------------------+ +| -c, --create PATH | Create a DesktopEntry file for the program at the given | +| | path. An optional second argument is used to specify the | +| | filename of the created DesktopEntry file,or specify the | +| | filename - to print the file to stdout. By default a new | +| | file is createdwith the .desktop file extension. | ++------------------------------------+------------------------------------------------------------+ +| -d, --dry-run | Dry run, don't execute any command | ++------------------------------------+------------------------------------------------------------+ +| -e, --environment ENVIRONMENT | Specify the Desktop Environment an autostart should be | +| | performed for; works only in combination with -a | ++------------------------------------+------------------------------------------------------------+ +| -s, --search-paths SEARCHPATHS | Colon separated list of paths to search for desktop files, | +| | overriding the default search list | ++------------------------------------+------------------------------------------------------------+ +| -t, --target-directory ENVIRONMENT | Create files in target directory | ++------------------------------------+------------------------------------------------------------+ +| --test | Perform a self-test | ++------------------------------------+------------------------------------------------------------+ +| -v, --verbose | Verbose output | ++------------------------------------+------------------------------------------------------------+ +| -V, --version | Display version information | ++------------------------------------+------------------------------------------------------------+ + +Examples +-------- + +Perform an autostart/execute all programs in the autostart folders. + + ``dex -a`` + +Perform an autostart/execute all programs in the specified folders. + + ``dex -a -s /etc/xdg/autostart/:~/.config/autostart/`` + +Preview the programs would be executed in a regular autostart. + + ``dex -ad`` + +Preview the programs would be executed in a GNOME specific autostart. + + ``dex -ad -e GNOME`` + +Create a DesktopEntry for a program in the current directory. + + ``dex -c /usr/bin/skype`` + +Create a DesktopEntry for a programs in autostart directroy. + + ``dex -t ~/.config/autostart -c /usr/bin/skype /usr/bin/nm-applet`` + +Execute a single program from command line and enable verbose output. + + ``dex -v skype.desktop`` \ No newline at end of file