Cleanup usages/patching of awful.util.deprecate (#1966)

This commit is contained in:
Daniel Hahler 2017-08-10 12:18:54 +02:00 committed by GitHub
parent 2effc8e8df
commit 31e25dc6a5
7 changed files with 14 additions and 60 deletions

View File

@ -49,7 +49,6 @@ util.shell = os.getenv("SHELL") or "/bin/sh"
-- @see gears.debug -- @see gears.debug
function util.deprecate(see, args) function util.deprecate(see, args)
gdebug.deprecate("gears.debug.deprecate", {deprecated_in=5}) gdebug.deprecate("gears.debug.deprecate", {deprecated_in=5})
return gdebug.deprecate(see, args) return gdebug.deprecate(see, args)
end end
@ -63,7 +62,6 @@ end
-- @see gears.debug -- @see gears.debug
function util.deprecate_class(fallback, old_name, new_name) function util.deprecate_class(fallback, old_name, new_name)
gdebug.deprecate("gears.debug.deprecate_class", {deprecated_in=5}) gdebug.deprecate("gears.debug.deprecate_class", {deprecated_in=5})
return gdebug.deprecate_class(fallback, old_name, new_name) return gdebug.deprecate_class(fallback, old_name, new_name)
end end
@ -75,7 +73,6 @@ end
-- @see gears.color -- @see gears.color
function util.ensure_pango_color(color, fallback) function util.ensure_pango_color(color, fallback)
gdebug.deprecate("gears.color.ensure_pango_color", {deprecated_in=5}) gdebug.deprecate("gears.color.ensure_pango_color", {deprecated_in=5})
return gcolor.ensure_pango_color(color, fallback) return gcolor.ensure_pango_color(color, fallback)
end end
@ -87,7 +84,6 @@ end
-- @see gears.math -- @see gears.math
function util.cycle(t, i) function util.cycle(t, i)
gdebug.deprecate("gears.math.cycle", {deprecated_in=5}) gdebug.deprecate("gears.math.cycle", {deprecated_in=5})
return gmath.cycle(t, i) return gmath.cycle(t, i)
end end
@ -97,8 +93,7 @@ end
-- @return mkdir return code -- @return mkdir return code
-- @see gears.filesystem -- @see gears.filesystem
function util.mkdir(dir) function util.mkdir(dir)
util.deprecate("gears.filesystem.make_directories", {deprecated_in=5}) gdebug.deprecate("gears.filesystem.make_directories", {deprecated_in=5})
return gfs.make_directories(dir) return gfs.make_directories(dir)
end end
@ -116,7 +111,6 @@ end
-- @see gears.string -- @see gears.string
function util.escape(text) function util.escape(text)
gdebug.deprecate("gears.string.xml_escape", {deprecated_in=5}) gdebug.deprecate("gears.string.xml_escape", {deprecated_in=5})
return gstring.xml_escape(text) return gstring.xml_escape(text)
end end
@ -127,7 +121,6 @@ end
-- @see gears.string -- @see gears.string
function util.unescape(text) function util.unescape(text)
gdebug.deprecate("gears.string.xml_unescape", {deprecated_in=5}) gdebug.deprecate("gears.string.xml_unescape", {deprecated_in=5})
return gstring.xml_unescape(text) return gstring.xml_unescape(text)
end end
@ -162,8 +155,7 @@ end
-- @return the config home (XDG_CONFIG_HOME) with a slash at the end. -- @return the config home (XDG_CONFIG_HOME) with a slash at the end.
-- @see gears.filesystem -- @see gears.filesystem
function util.get_xdg_config_home() function util.get_xdg_config_home()
util.deprecate("gears.filesystem.get_xdg_config_home", {deprecated_in=5}) gdebug.deprecate("gears.filesystem.get_xdg_config_home", {deprecated_in=5})
return gfs.get_xdg_config_home() return gfs.get_xdg_config_home()
end end
@ -172,8 +164,7 @@ end
-- @return the cache home (XDG_CACHE_HOME) with a slash at the end. -- @return the cache home (XDG_CACHE_HOME) with a slash at the end.
-- @see gears.filesystem -- @see gears.filesystem
function util.get_xdg_cache_home() function util.get_xdg_cache_home()
util.deprecate("gears.filesystem.get_xdg_cache_home", {deprecated_in=5}) gdebug.deprecate("gears.filesystem.get_xdg_cache_home", {deprecated_in=5})
return gfs.get_xdg_cache_home() return gfs.get_xdg_cache_home()
end end
@ -183,8 +174,7 @@ end
-- @return A string with the requested path with a slash at the end. -- @return A string with the requested path with a slash at the end.
-- @see gears.filesystem -- @see gears.filesystem
function util.get_configuration_dir() function util.get_configuration_dir()
util.deprecate("gears.filesystem.get_configuration_dir", {deprecated_in=5}) gdebug.deprecate("gears.filesystem.get_configuration_dir", {deprecated_in=5})
return gfs.get_configuration_dir() return gfs.get_configuration_dir()
end end
@ -193,8 +183,7 @@ end
-- @return A string with the requested path with a slash at the end. -- @return A string with the requested path with a slash at the end.
-- @see gears.filesystem -- @see gears.filesystem
function util.get_cache_dir() function util.get_cache_dir()
util.deprecate("gears.filesystem.get_cache_dir", {deprecated_in=5}) gdebug.deprecate("gears.filesystem.get_cache_dir", {deprecated_in=5})
return gfs.get_cache_dir() return gfs.get_cache_dir()
end end
@ -203,8 +192,7 @@ end
-- @return A string with the requested path with a slash at the end. -- @return A string with the requested path with a slash at the end.
-- @see gears.filesystem -- @see gears.filesystem
function util.get_themes_dir() function util.get_themes_dir()
util.deprecate("gears.filesystem.get_themes_dir", {deprecated_in=5}) gdebug.deprecate("gears.filesystem.get_themes_dir", {deprecated_in=5})
return gfs.get_themes_dir() return gfs.get_themes_dir()
end end
@ -213,8 +201,7 @@ end
-- @return A string with the requested path with a slash at the end. -- @return A string with the requested path with a slash at the end.
-- @see gears.filesystem -- @see gears.filesystem
function util.get_awesome_icon_dir() function util.get_awesome_icon_dir()
util.deprecate("gears.filesystem.get_awesome_icon_dir", {deprecated_in=5}) gdebug.deprecate("gears.filesystem.get_awesome_icon_dir", {deprecated_in=5})
return gfs.get_awesome_icon_dir() return gfs.get_awesome_icon_dir()
end end
@ -226,8 +213,7 @@ end
-- @return A string containing the requested path. -- @return A string containing the requested path.
-- @see gears.filesystem -- @see gears.filesystem
function util.getdir(d) function util.getdir(d)
util.deprecate("gears.filesystem.get_dir", {deprecated_in=5}) gdebug.deprecate("gears.filesystem.get_dir", {deprecated_in=5})
return gfs.get_dir(d) return gfs.get_dir(d)
end end
@ -269,8 +255,7 @@ end
-- @return True if file exists and is readable. -- @return True if file exists and is readable.
-- @see gears.filesystem -- @see gears.filesystem
function util.file_readable(filename) function util.file_readable(filename)
util.deprecate("gears.filesystem.file_readable", {deprecated_in=5}) gdebug.deprecate("gears.filesystem.file_readable", {deprecated_in=5})
return gfs.file_readable(filename) return gfs.file_readable(filename)
end end
@ -280,8 +265,7 @@ end
-- @treturn boolean True if dir exists and is readable. -- @treturn boolean True if dir exists and is readable.
-- @see gears.filesystem -- @see gears.filesystem
function util.dir_readable(path) function util.dir_readable(path)
util.deprecate("gears.filesystem.dir_readable", {deprecated_in=5}) gdebug.deprecate("gears.filesystem.dir_readable", {deprecated_in=5})
return gfs.dir_readable(path) return gfs.dir_readable(path)
end end
@ -291,8 +275,7 @@ end
-- @treturn bool True if path exists and is a directory. -- @treturn bool True if path exists and is a directory.
-- @see gears.filesystem -- @see gears.filesystem
function util.is_dir(path) function util.is_dir(path)
util.deprecate("gears.filesystem.is_dir", {deprecated_in=5}) gdebug.deprecate("gears.filesystem.is_dir", {deprecated_in=5})
return gfs.is_dir(path) return gfs.is_dir(path)
end end
@ -307,7 +290,6 @@ end
-- @see gears.math -- @see gears.math
function util.subsets(set) function util.subsets(set)
gdebug.deprecate("gears.math.subsets", {deprecated_in=5}) gdebug.deprecate("gears.math.subsets", {deprecated_in=5})
return gmath.subsets(set) return gmath.subsets(set)
end end
@ -321,7 +303,6 @@ end
-- @see gears.geometry -- @see gears.geometry
function util.get_rectangle_in_direction(dir, recttbl, cur) function util.get_rectangle_in_direction(dir, recttbl, cur)
gdebug.deprecate("gears.geometry.rectangle.get_in_direction", {deprecated_in=4}) gdebug.deprecate("gears.geometry.rectangle.get_in_direction", {deprecated_in=4})
return grect.get_in_direction(dir, recttbl, cur) return grect.get_in_direction(dir, recttbl, cur)
end end
@ -333,7 +314,6 @@ end
-- @see gears.table -- @see gears.table
function util.table.join(...) function util.table.join(...)
gdebug.deprecate("gears.table.join", {deprecated_in=5}) gdebug.deprecate("gears.table.join", {deprecated_in=5})
return gtable.join(...) return gtable.join(...)
end end
@ -348,7 +328,6 @@ end
-- @see gears.table -- @see gears.table
function util.table.crush(t, set, raw) function util.table.crush(t, set, raw)
gdebug.deprecate("gears.table.crush", {deprecated_in=5}) gdebug.deprecate("gears.table.crush", {deprecated_in=5})
return gtable.crush(t, set, raw) return gtable.crush(t, set, raw)
end end
@ -365,7 +344,6 @@ end
-- @see gears.table -- @see gears.table
function util.table.from_sparse(t) function util.table.from_sparse(t)
gdebug.deprecate("gears.table.from_sparse", {deprecated_in=5}) gdebug.deprecate("gears.table.from_sparse", {deprecated_in=5})
return gtable.from_sparse(t) return gtable.from_sparse(t)
end end
@ -377,7 +355,6 @@ end
-- @see gears.table -- @see gears.table
function util.table.hasitem(t, item) function util.table.hasitem(t, item)
gdebug.deprecate("gears.table.hasitem", {deprecated_in=5}) gdebug.deprecate("gears.table.hasitem", {deprecated_in=5})
return gtable.hasitem(t, item) return gtable.hasitem(t, item)
end end
@ -390,7 +367,6 @@ end
-- @see gears.string -- @see gears.string
function util.linewrap(text, width, indent) function util.linewrap(text, width, indent)
gdebug.deprecate("gears.string.linewrap", {deprecated_in=5}) gdebug.deprecate("gears.string.linewrap", {deprecated_in=5})
return gstring.linewrap(text, width, indent) return gstring.linewrap(text, width, indent)
end end
@ -401,7 +377,6 @@ end
-- @see gears.string -- @see gears.string
function util.linecount(text) function util.linecount(text)
gdebug.deprecate("gears.string.linecount", {deprecated_in=5}) gdebug.deprecate("gears.string.linecount", {deprecated_in=5})
return gstring.linecount(text) return gstring.linecount(text)
end end
@ -412,7 +387,6 @@ end
-- @see gears.table -- @see gears.table
function util.table.keys(t) function util.table.keys(t)
gdebug.deprecate("gears.table.keys", {deprecated_in=5}) gdebug.deprecate("gears.table.keys", {deprecated_in=5})
return gtable.keys(t) return gtable.keys(t)
end end
@ -424,7 +398,6 @@ end
-- @see gears.table -- @see gears.table
function util.table.keys_filter(t, ...) function util.table.keys_filter(t, ...)
gdebug.deprecate("gears.table.keys_filter", {deprecated_in=5}) gdebug.deprecate("gears.table.keys_filter", {deprecated_in=5})
return gtable.keys_filter(t, ...) return gtable.keys_filter(t, ...)
end end
@ -435,7 +408,6 @@ end
-- @see gears.table -- @see gears.table
function util.table.reverse(t) function util.table.reverse(t)
gdebug.deprecate("gears.table.reverse", {deprecated_in=5}) gdebug.deprecate("gears.table.reverse", {deprecated_in=5})
return gtable.reverse(t) return gtable.reverse(t)
end end
@ -447,7 +419,6 @@ end
-- @see gears.table -- @see gears.table
function util.table.clone(t, deep) function util.table.clone(t, deep)
gdebug.deprecate("gears.table.clone", {deprecated_in=5}) gdebug.deprecate("gears.table.clone", {deprecated_in=5})
return gtable.clone(t, deep) return gtable.clone(t, deep)
end end
@ -463,7 +434,6 @@ end
-- @see gears.table -- @see gears.table
function util.table.iterate(t, filter, start) function util.table.iterate(t, filter, start)
gdebug.deprecate("gears.table.iterate", {deprecated_in=5}) gdebug.deprecate("gears.table.iterate", {deprecated_in=5})
return gtable.iterate(t, filter, start) return gtable.iterate(t, filter, start)
end end
@ -476,7 +446,6 @@ end
-- @see gears.table -- @see gears.table
function util.table.merge(t, set) function util.table.merge(t, set)
gdebug.deprecate("gears.table.merge", {deprecated_in=5}) gdebug.deprecate("gears.table.merge", {deprecated_in=5})
return gtable.merge(t, set) return gtable.merge(t, set)
end end
@ -488,7 +457,6 @@ end
-- @see gears.string -- @see gears.string
function util.quote_pattern(s) function util.quote_pattern(s)
gdebug.deprecate("gears.string.quote_pattern", {deprecated_in=5}) gdebug.deprecate("gears.string.quote_pattern", {deprecated_in=5})
return gstring.quote_pattern(s) return gstring.quote_pattern(s)
end end
@ -498,7 +466,6 @@ end
-- @see gears.string -- @see gears.string
function util.query_to_pattern(q) function util.query_to_pattern(q)
gdebug.deprecate("gears.string.query_to_pattern", {deprecated_in=5}) gdebug.deprecate("gears.string.query_to_pattern", {deprecated_in=5})
return gstring.query_to_pattern(q) return gstring.query_to_pattern(q)
end end
@ -509,7 +476,6 @@ end
-- @see gears.math -- @see gears.math
function util.round(x) function util.round(x)
gdebug.deprecate("gears.math.round", {deprecated_in=5}) gdebug.deprecate("gears.math.round", {deprecated_in=5})
return gmath.round(x) return gmath.round(x)
end end

View File

@ -33,6 +33,7 @@ local theme = require("beautiful")
local wibox = require("wibox") local wibox = require("wibox")
local gcolor = require("gears.color") local gcolor = require("gears.color")
local gstring = require("gears.string") local gstring = require("gears.string")
local gdebug = require("gears.debug")
local function get_screen(s) local function get_screen(s)
return s and capi.screen[s] return s and capi.screen[s]
@ -469,7 +470,7 @@ end
-- @return menubar wibox. -- @return menubar wibox.
-- @deprecated get -- @deprecated get
function menubar.get(scr) function menubar.get(scr)
awful.util.deprecate("Use menubar.show() instead", { deprecated_in = 5 }) gdebug.deprecate("Use menubar.show() instead", { deprecated_in = 5 })
menubar.refresh(scr) menubar.refresh(scr)
-- Add to each category the name of its key in all_categories -- Add to each category the name of its key in all_categories
for k, v in pairs(menubar.menu_gen.all_categories) do for k, v in pairs(menubar.menu_gen.all_categories) do

View File

@ -24,12 +24,7 @@ local function num_pairs(container_table)
return number_of_items return number_of_items
end end
-- display deprecated warnings
--awful.util.deprecate = function() end
local steps = { local steps = {
function(count) function(count)
if count <= 5 then if count <= 5 then
awful.spawn("xterm") awful.spawn("xterm")

View File

@ -1,13 +1,9 @@
local awful = require("awful") local awful = require("awful")
local test_client = require("_client") local test_client = require("_client")
awful.util.deprecate = function() end
local has_spawned = false local has_spawned = false
local steps = { local steps = {
function(count) function(count)
if count <= 1 and not has_spawned and #client.get() < 2 then if count <= 1 and not has_spawned and #client.get() < 2 then
awful.spawn("xterm") awful.spawn("xterm")
awful.spawn("xterm") awful.spawn("xterm")

View File

@ -1,7 +1,5 @@
local awful = require("awful") local awful = require("awful")
awful.util.deprecate = function() end
local has_spawned = false local has_spawned = false
local steps = { local steps = {
function(count) function(count)

View File

@ -1,8 +1,6 @@
local awful = require("awful") local awful = require("awful")
local beautiful = require("beautiful") local beautiful = require("beautiful")
awful.util.deprecate = function() end
local function check_order() local function check_order()
local tags = mouse.screen.tags local tags = mouse.screen.tags

View File

@ -1,2 +1,2 @@
require("awful.util").deprecate("Use beautiful.theme_assets instead.") require("gears.debug").deprecate("Use beautiful.theme_assets instead.")
return require("beautiful.theme_assets") return require("beautiful.theme_assets")