From a2624cebd5bfbedd94e9ec93c0b774e371c68808 Mon Sep 17 00:00:00 2001 From: Iceyer Date: Wed, 13 Sep 2017 13:07:08 +0800 Subject: [PATCH] Update license Change-Id: I9a1ab231ee77a9f040a94a07d2c06e6c7a1b0ecd --- src/base/dobject.cpp | 20 +- src/base/dobject.h | 20 +- src/base/dsingleton.h | 20 +- src/base/private/dobject_p.h | 20 +- src/dtkcore_global.h | 20 +- src/filesystem/dbasefilewatcher.cpp | 20 +- src/filesystem/dbasefilewatcher.h | 20 +- src/filesystem/dfilesystemwatcher.h | 20 +- src/filesystem/dfilesystemwatcher_linux.cpp | 20 +- src/filesystem/dfilesystemwatcher_win.cpp | 20 +- src/filesystem/dfilewatcher.cpp | 20 +- src/filesystem/dfilewatcher.h | 20 +- src/filesystem/dfilewatchermanager.cpp | 20 +- src/filesystem/dfilewatchermanager.h | 20 +- src/filesystem/dpathbuf.h | 20 +- src/filesystem/dstandardpaths.cpp | 20 +- src/filesystem/dstandardpaths.h | 20 +- src/filesystem/private/dbasefilewatcher_p.h | 20 +- .../private/dfilesystemwatcher_linux_p.h | 20 +- .../private/dfilesystemwatcher_win_p.h | 21 +- src/log/AbstractAppender.cpp | 17 + src/log/CuteLogger_global.h | 20 +- src/log/LogManager.cpp | 17 + src/log/LogManager.h | 20 +- src/log/RollingFileAppender.cpp | 17 + src/log/RollingFileAppender.h | 20 +- src/settings/backend/qsettingbackend.cpp | 20 +- src/settings/backend/qsettingbackend.h | 20 +- src/settings/dsettings.cpp | 20 +- src/settings/dsettings.h | 20 +- src/settings/dsettingsbackend.h | 21 +- src/settings/dsettingsgroup.cpp | 20 +- src/settings/dsettingsgroup.h | 20 +- src/settings/dsettingsoption.cpp | 20 +- src/settings/dsettingsoption.h | 20 +- src/util/dutil.h | 20 +- tests/dutiltester.cpp | 20 +- tests/dutiltester.h | 20 +- tests/main.cpp | 20 +- tests/singletontester.cpp | 20 +- tests/singletontester.h | 20 +- tool/license/license-updater.py | 318 ++++++++++++++++++ tool/{ => settings}/main.cpp | 17 + tool/settings/settings.pro | 28 ++ tool/tool.pro | 30 +- 45 files changed, 951 insertions(+), 255 deletions(-) create mode 100644 tool/license/license-updater.py rename tool/{ => settings}/main.cpp (84%) create mode 100644 tool/settings/settings.pro diff --git a/src/base/dobject.cpp b/src/base/dobject.cpp index 8e28a6e..5f3cd7f 100644 --- a/src/base/dobject.cpp +++ b/src/base/dobject.cpp @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2015 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2015 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "dobject.h" #include "private/dobject_p.h" diff --git a/src/base/dobject.h b/src/base/dobject.h index 4757bd0..a06e071 100644 --- a/src/base/dobject.h +++ b/src/base/dobject.h @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2015 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2015 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #ifndef DOBJECT_H #define DOBJECT_H diff --git a/src/base/dsingleton.h b/src/base/dsingleton.h index f9f9ebb..6c0e37e 100644 --- a/src/base/dsingleton.h +++ b/src/base/dsingleton.h @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2016 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2016 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #ifndef DSINGLETON_H #define DSINGLETON_H diff --git a/src/base/private/dobject_p.h b/src/base/private/dobject_p.h index 9a431cc..f6b209e 100644 --- a/src/base/private/dobject_p.h +++ b/src/base/private/dobject_p.h @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2015 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2015 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #ifndef DOBJECT_P_H #define DOBJECT_P_H diff --git a/src/dtkcore_global.h b/src/dtkcore_global.h index 06ae06e..ecb3ec4 100644 --- a/src/dtkcore_global.h +++ b/src/dtkcore_global.h @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2017 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #pragma once diff --git a/src/filesystem/dbasefilewatcher.cpp b/src/filesystem/dbasefilewatcher.cpp index c2ca79f..9de1172 100644 --- a/src/filesystem/dbasefilewatcher.cpp +++ b/src/filesystem/dbasefilewatcher.cpp @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2017 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "dbasefilewatcher.h" #include "private/dbasefilewatcher_p.h" diff --git a/src/filesystem/dbasefilewatcher.h b/src/filesystem/dbasefilewatcher.h index 2d0b37b..4ebd4e8 100644 --- a/src/filesystem/dbasefilewatcher.h +++ b/src/filesystem/dbasefilewatcher.h @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2017 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #ifndef DBASEFILEWATCHER_H #define DBASEFILEWATCHER_H diff --git a/src/filesystem/dfilesystemwatcher.h b/src/filesystem/dfilesystemwatcher.h index 39cdda5..939fccc 100644 --- a/src/filesystem/dfilesystemwatcher.h +++ b/src/filesystem/dfilesystemwatcher.h @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2017 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #ifndef DFILESYSTEMWATCHER_H #define DFILESYSTEMWATCHER_H diff --git a/src/filesystem/dfilesystemwatcher_linux.cpp b/src/filesystem/dfilesystemwatcher_linux.cpp index aa1f637..17fcac3 100644 --- a/src/filesystem/dfilesystemwatcher_linux.cpp +++ b/src/filesystem/dfilesystemwatcher_linux.cpp @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2017 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "dfilesystemwatcher.h" #include "private/dfilesystemwatcher_linux_p.h" diff --git a/src/filesystem/dfilesystemwatcher_win.cpp b/src/filesystem/dfilesystemwatcher_win.cpp index 69bd597..e1e5fc5 100644 --- a/src/filesystem/dfilesystemwatcher_win.cpp +++ b/src/filesystem/dfilesystemwatcher_win.cpp @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2017 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "dfilesystemwatcher.h" #include "private/dfilesystemwatcher_win_p.h" diff --git a/src/filesystem/dfilewatcher.cpp b/src/filesystem/dfilewatcher.cpp index 1e47872..0becdd4 100644 --- a/src/filesystem/dfilewatcher.cpp +++ b/src/filesystem/dfilewatcher.cpp @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2017 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "dfilewatcher.h" #include "private/dbasefilewatcher_p.h" diff --git a/src/filesystem/dfilewatcher.h b/src/filesystem/dfilewatcher.h index 7dba2ec..fb44d01 100644 --- a/src/filesystem/dfilewatcher.h +++ b/src/filesystem/dfilewatcher.h @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2017 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #ifndef DFILEWATCHER_H #define DFILEWATCHER_H diff --git a/src/filesystem/dfilewatchermanager.cpp b/src/filesystem/dfilewatchermanager.cpp index e5b60cf..f6e0676 100644 --- a/src/filesystem/dfilewatchermanager.cpp +++ b/src/filesystem/dfilewatchermanager.cpp @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2017 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "dfilewatchermanager.h" #include "dfilewatcher.h" diff --git a/src/filesystem/dfilewatchermanager.h b/src/filesystem/dfilewatchermanager.h index f6e3e55..8b5c828 100644 --- a/src/filesystem/dfilewatchermanager.h +++ b/src/filesystem/dfilewatchermanager.h @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2017 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #ifndef DFILEWATCHERMANAGER_H #define DFILEWATCHERMANAGER_H diff --git a/src/filesystem/dpathbuf.h b/src/filesystem/dpathbuf.h index 4b38402..499dc11 100644 --- a/src/filesystem/dpathbuf.h +++ b/src/filesystem/dpathbuf.h @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2017 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #pragma once diff --git a/src/filesystem/dstandardpaths.cpp b/src/filesystem/dstandardpaths.cpp index cbfca54..bad435d 100644 --- a/src/filesystem/dstandardpaths.cpp +++ b/src/filesystem/dstandardpaths.cpp @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2017 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "dstandardpaths.h" diff --git a/src/filesystem/dstandardpaths.h b/src/filesystem/dstandardpaths.h index 740a647..c749cae 100644 --- a/src/filesystem/dstandardpaths.h +++ b/src/filesystem/dstandardpaths.h @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2017 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #ifndef DTK_CORE_FILESYSTEM_DSTANDARDPATHS_H #define DTK_CORE_FILESYSTEM_DSTANDARDPATHS_H diff --git a/src/filesystem/private/dbasefilewatcher_p.h b/src/filesystem/private/dbasefilewatcher_p.h index 9304e15..3eaae3e 100644 --- a/src/filesystem/private/dbasefilewatcher_p.h +++ b/src/filesystem/private/dbasefilewatcher_p.h @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2017 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #ifndef DBASEFILEWATCHER_P_H #define DBASEFILEWATCHER_P_H diff --git a/src/filesystem/private/dfilesystemwatcher_linux_p.h b/src/filesystem/private/dfilesystemwatcher_linux_p.h index ceb409b..a880a8a 100644 --- a/src/filesystem/private/dfilesystemwatcher_linux_p.h +++ b/src/filesystem/private/dfilesystemwatcher_linux_p.h @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2017 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #ifndef DFILESYSTEMWATCHER_P_H #define DFILESYSTEMWATCHER_P_H diff --git a/src/filesystem/private/dfilesystemwatcher_win_p.h b/src/filesystem/private/dfilesystemwatcher_win_p.h index 52d8af5..67311b6 100644 --- a/src/filesystem/private/dfilesystemwatcher_win_p.h +++ b/src/filesystem/private/dfilesystemwatcher_win_p.h @@ -1,11 +1,20 @@ -/** - * Copyright (C) 2017 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #ifndef DFILESYSTEMWATCHER_WIN_P_H #define DFILESYSTEMWATCHER_WIN_P_H diff --git a/src/log/AbstractAppender.cpp b/src/log/AbstractAppender.cpp index 2dfee02..a4fe340 100644 --- a/src/log/AbstractAppender.cpp +++ b/src/log/AbstractAppender.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + // Local #include "AbstractAppender.h" diff --git a/src/log/CuteLogger_global.h b/src/log/CuteLogger_global.h index 411ae6e..ffa2ad8 100644 --- a/src/log/CuteLogger_global.h +++ b/src/log/CuteLogger_global.h @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2017 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #ifndef CUTELOGGER_GLOBAL_H #define CUTELOGGER_GLOBAL_H diff --git a/src/log/LogManager.cpp b/src/log/LogManager.cpp index cbbac76..2eb5498 100644 --- a/src/log/LogManager.cpp +++ b/src/log/LogManager.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include "LogManager.h" #include #include diff --git a/src/log/LogManager.h b/src/log/LogManager.h index bdd6e35..85fa6fc 100644 --- a/src/log/LogManager.h +++ b/src/log/LogManager.h @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2017 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #ifndef LOGMANAGER_H #define LOGMANAGER_H diff --git a/src/log/RollingFileAppender.cpp b/src/log/RollingFileAppender.cpp index 1f9a4af..ce1a65b 100644 --- a/src/log/RollingFileAppender.cpp +++ b/src/log/RollingFileAppender.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include #include #include diff --git a/src/log/RollingFileAppender.h b/src/log/RollingFileAppender.h index c7c9a8e..a93ded2 100644 --- a/src/log/RollingFileAppender.h +++ b/src/log/RollingFileAppender.h @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2017 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #ifndef ROLLINGFILEAPPENDER_H #define ROLLINGFILEAPPENDER_H diff --git a/src/settings/backend/qsettingbackend.cpp b/src/settings/backend/qsettingbackend.cpp index 67bf941..6893c47 100644 --- a/src/settings/backend/qsettingbackend.cpp +++ b/src/settings/backend/qsettingbackend.cpp @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2016 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2016 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "qsettingbackend.h" diff --git a/src/settings/backend/qsettingbackend.h b/src/settings/backend/qsettingbackend.h index 4f61d13..643d05e 100644 --- a/src/settings/backend/qsettingbackend.h +++ b/src/settings/backend/qsettingbackend.h @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2016 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2016 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #pragma once diff --git a/src/settings/dsettings.cpp b/src/settings/dsettings.cpp index a463aa1..9ce4c1d 100644 --- a/src/settings/dsettings.cpp +++ b/src/settings/dsettings.cpp @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2016 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2016 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "dsettings.h" diff --git a/src/settings/dsettings.h b/src/settings/dsettings.h index e984e4a..4353106 100644 --- a/src/settings/dsettings.h +++ b/src/settings/dsettings.h @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2016 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2016 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #pragma once diff --git a/src/settings/dsettingsbackend.h b/src/settings/dsettingsbackend.h index de9f67f..19b5552 100644 --- a/src/settings/dsettingsbackend.h +++ b/src/settings/dsettingsbackend.h @@ -1,12 +1,19 @@ -/** - * Copyright (C) 2016 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2016 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ - + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #pragma once diff --git a/src/settings/dsettingsgroup.cpp b/src/settings/dsettingsgroup.cpp index 6c24e49..da68b43 100644 --- a/src/settings/dsettingsgroup.cpp +++ b/src/settings/dsettingsgroup.cpp @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2016 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2016 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "dsettingsgroup.h" diff --git a/src/settings/dsettingsgroup.h b/src/settings/dsettingsgroup.h index 68449c9..b39229b 100644 --- a/src/settings/dsettingsgroup.h +++ b/src/settings/dsettingsgroup.h @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2016 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2016 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #pragma once diff --git a/src/settings/dsettingsoption.cpp b/src/settings/dsettingsoption.cpp index d0581af..2410c6f 100644 --- a/src/settings/dsettingsoption.cpp +++ b/src/settings/dsettingsoption.cpp @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2016 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2016 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "dsettingsoption.h" diff --git a/src/settings/dsettingsoption.h b/src/settings/dsettingsoption.h index f055b54..346923d 100644 --- a/src/settings/dsettingsoption.h +++ b/src/settings/dsettingsoption.h @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2016 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2016 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #pragma once diff --git a/src/util/dutil.h b/src/util/dutil.h index 376e9fc..f1ca0cb 100644 --- a/src/util/dutil.h +++ b/src/util/dutil.h @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2016 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2016 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #pragma once diff --git a/tests/dutiltester.cpp b/tests/dutiltester.cpp index c4ae4d0..a4fce03 100644 --- a/tests/dutiltester.cpp +++ b/tests/dutiltester.cpp @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2017 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "dutiltester.h" diff --git a/tests/dutiltester.h b/tests/dutiltester.h index b785b3d..2fddddf 100644 --- a/tests/dutiltester.h +++ b/tests/dutiltester.h @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2017 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #ifndef DUTILTESTER_H #define DUTILTESTER_H diff --git a/tests/main.cpp b/tests/main.cpp index 0abaecb..0c1f4c2 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2017 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include diff --git a/tests/singletontester.cpp b/tests/singletontester.cpp index 406aa82..87c17cb 100644 --- a/tests/singletontester.cpp +++ b/tests/singletontester.cpp @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2016 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2016 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "singletontester.h" diff --git a/tests/singletontester.h b/tests/singletontester.h index ab8ba0d..8f13e87 100644 --- a/tests/singletontester.h +++ b/tests/singletontester.h @@ -1,11 +1,19 @@ -/** - * Copyright (C) 2016 Deepin Technology Co., Ltd. +/* + * Copyright (C) 2016 ~ 2017 Deepin Technology Co., Ltd. * - * This program is free software; you can redistribute it and/or modify + * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - **/ + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #pragma once diff --git a/tool/license/license-updater.py b/tool/license/license-updater.py new file mode 100644 index 0000000..6b78009 --- /dev/null +++ b/tool/license/license-updater.py @@ -0,0 +1,318 @@ +import fnmatch +import os +import argparse +import re +import datetime + + +license_header = '''/*\n''' +license_empty = ''' *\n''' +license_copyright_prifix = ''' * Copyright (C) {0}\n''' +license_copyright_indent = ''' * {0}\n''' +license_author_prifix = ''' * Author: {0}\n''' +license_person_indent = ''' * {0}\n''' +license_maintainer_prifix = ''' * Maintainer: {0}\n''' +license_tail = ''' */\n\n''' +default_license_body = ''' * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . +''' + + +def isInt(value): + try: + int(value) + return True + except ValueError: + return False + + +class Copyright: + def __init__(self, line): + self.year_start = datetime.datetime.now().year + self.year_end = datetime.datetime.now().year + + if "copyright" in line.lower(): + line = line[re.search("copyright", line, re.IGNORECASE).end():] + + copyright_sysbol = re.search("\(.\)", line, re.IGNORECASE) + if copyright_sysbol is not None: + copyright_brace_end_pos = copyright_sysbol.end() + line = line[copyright_brace_end_pos:] + pass + + if re.search("[0-9]+", line) is not None: + year_start_pos = re.search("[0-9]+", line).start() + year_start_end_pos = re.search("[0-9]+", line).end() + self.year_start = int(line[year_start_pos: year_start_end_pos]) + line = line[year_start_end_pos:] + + if re.search("[0-9]+", line) is not None: + year_end_pos = re.search("[0-9]+", line).start() + year_end_end_pos = re.search("[0-9]+", line).end() + if re.search("~", line) is not None: + year_spilt = re.search("~", line).start() + if (year_spilt < year_end_pos): + self.year_end = int(line[year_end_pos: year_end_end_pos]) + line = line[year_end_end_pos:] + + self.name = line.strip() + + def string(self): + return "{0} ~ {1} {2}".format( + self.year_start, + self.year_end, + self.name) + + +class Person: + def __init__(self, line): + if re.search(":", line, re.IGNORECASE) is not None: + split_end = re.search(":", line).end() + line = line[split_end:] + + self.name = line.strip() + + +def filter_files(file_list, ext_list): + for file in file_list: + for ext in ext_list: + if fnmatch.fnmatch(file, ext): + yield file + break + + +class Source: + def __init__(self, filename): + self.body = [] + self.copyrights = {} + self.authors = {} + self.maintainers = {} + self.filename = filename + self.is_deepin_copyright = False + self.update_license(filename) + + def update_license(self, filename): + find_license_start = False + find_license_end = False + + parse_copyright_start = False + parse_author_start = False + parse_maintainer_start = False + + with open(filename, "r") as f: + print("process:", filename) + for line in f: + if line.strip().startswith("/*") and (0 == len(self.body)): + find_license_start = True + + if (0 != len(self.body)) or (0 != len(line.strip())): + self.body.append(line) + + if "*/" in line.strip() and find_license_start: + if not find_license_end: + # print("clean body") + self.body = [] + find_license_end = True + + if find_license_start and not find_license_end: + if re.search("(\*)+", line): + # remove ***** + line = line[re.search("(\*)+", line).end():] + + if "copyright" in line.lower(): + parse_copyright_start = True + parse_author_start = False + parse_maintainer_start = False + if "author" in line.lower(): + parse_copyright_start = False + parse_author_start = True + parse_maintainer_start = False + if "maintainer" in line.lower(): + parse_copyright_start = False + parse_author_start = False + parse_maintainer_start = True + if 0 == len(line.strip()): + parse_copyright_start = False + parse_author_start = False + parse_maintainer_start = False + + if parse_copyright_start: + cr = Copyright(line) + self.copyrights[cr.name] = cr + + if parse_author_start: + p = Person(line) + self.authors[p.name] = p + + if parse_maintainer_start: + p = Person(line) + self.maintainers[p.name] = p + + def fix_deepin(self): + new_cr = {} + self.is_deepin_copyright = False + for k, cr in self.copyrights.items(): + if "deepin" in cr.name.lower(): + cr.name = "Deepin Technology Co., Ltd." + self.is_deepin_copyright = True + new_cr[cr.name] = cr + self.copyrights = new_cr + + def dump(self): + for cr in self.copyrights: + print(cr.year_start, cr.year_end, cr.name) + for a in self.authors: + print(a.name) + for a in self.maintainers: + print(a.name) + print("body size:", len(self.body)) + + def save(self): + wf = open(self.filename, 'w') + wf.write(license_header) + + if len(self.copyrights): + write_first = False + for k, cr in self.copyrights.items(): + if not write_first: + wf.write(license_copyright_prifix.format(cr.string())) + write_first = True + else: + wf.write(license_copyright_indent.format(cr.string())) + wf.write(license_empty) + + if len(self.authors): + write_first = False + for k, author in self.authors.items(): + if not write_first: + wf.write(license_author_prifix.format(author.name)) + write_first = True + else: + wf.write(license_person_indent.format(author.name)) + wf.write(license_empty) + + if len(self.maintainers): + write_first = False + for k, maintainer in self.maintainers.items(): + if not write_first: + wf.write(license_maintainer_prifix.format(maintainer.name)) + write_first = True + else: + wf.write(license_person_indent.format(maintainer.name)) + wf.write(license_empty) + + wf.write(default_license_body) + wf.write(license_tail) + + for l in self.body: + wf.write(l) + wf.close() + + +def parse_args(): + parser = argparse.ArgumentParser() + parser.add_argument('--authors', help='''authors split by ":". For example:\n + "Iceyer :Li He "''') + parser.add_argument('--maintainers', help='''maintainers split by ":". For example: \n + "Iceyer :Li He "''') + parser.add_argument('--copyrights', help='''copyrights split by ":". For example: \n + "2011 ~ 2017 Deepin Technology Co., Ltd.:2011 ~ 2017 Li He"''') + parser.add_argument('--fix-deepin', dest='fixdeepin', + action='store_const', const=True, default=False, help=''' + fix deein copyrights''') + parser.add_argument('dir', help=''' + source code dir''') + + args = parser.parse_args() + return args + + +def match_files(dir): + EXTENSIONS = "*.cpp", "*.c", "*.h", "*.go" + matches = [] + for root, dirnames, filenames in os.walk(dir): + for filename in filter_files(filenames, EXTENSIONS): + matches.append(os.path.join(root, filename)) + return matches + + +def test(): + cr = Copyright("Copyright (C) Deepin Technology Co., Ltd.") + print(cr.year_start, cr.year_end, cr.name) + cr = Copyright("Copyright (C) 2007 Deepin Technology Co., Ltd.") + print(cr.year_start, cr.year_end, cr.name) + cr = Copyright("Copyright (C) 2007 ~ 2016 Deepin Technology Co., Ltd.") + print(cr.year_start, cr.year_end, cr.name) + + p = Person("Author: Wang Yong ") + print(p.name) + p = Person(" Wang Yong ") + print(p.name) + + +def get_authors(args): + authors = [] + if args.authors is not None: + for a in args.authors.split(":"): + authors.append(Person(a)) + return authors + + +def get_copyrights(args): + copyrights = [] + if args.copyrights is not None: + for a in args.copyrights.split(":"): + copyrights.append(Copyright(a)) + return copyrights + + +def get_maintainers(args): + maintainers = [] + if args.maintainers is not None: + for a in args.maintainers.split(":"): + maintainers.append(Copyright(a)) + return maintainers + + +def main(): + args = parse_args() + authors = get_authors(args) + copyrights = get_copyrights(args) + maintainers = get_maintainers(args) + fixdeepin = args.fixdeepin + files = match_files(args.dir) + + for filename in files: + s = Source(filename) + # s.dump() + if fixdeepin: + s.fix_deepin() + if not s.is_deepin_copyright and 0 != len(s.copyrights): + continue + + if 0 == len(s.copyrights): + for cr in copyrights: + s.copyrights[cr.name] = cr + + for p in authors: + s.authors[p.name] = p + + for p in maintainers: + s.maintainers[p.name] = p + + s.save() + # s.dump() + + +if __name__ == "__main__": + main() diff --git a/tool/main.cpp b/tool/settings/main.cpp similarity index 84% rename from tool/main.cpp rename to tool/settings/main.cpp index ba27490..b84b417 100644 --- a/tool/main.cpp +++ b/tool/settings/main.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include #include diff --git a/tool/settings/settings.pro b/tool/settings/settings.pro new file mode 100644 index 0000000..fb6e4cd --- /dev/null +++ b/tool/settings/settings.pro @@ -0,0 +1,28 @@ +QT += core +QT -= gui + +CONFIG += c++11 + +TARGET = dtk-settings-tool +CONFIG += console link_pkgconfig +CONFIG -= app_bundle + +TEMPLATE = app + +SOURCES += main.cpp + +isEmpty(PREFIX){ + PREFIX = /usr +} + +binary.files += $${OUT_PWD}/dtk-settings-tool +binary.path = $${PREFIX}/lib/dtk2 + +INSTALLS += binary + +win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../../src/release/ -ldtkcore +else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../../src/debug/ -ldtkcore +else:unix: LIBS += -L$$OUT_PWD/../../src/ -ldtkcore + +INCLUDEPATH += $$PWD/../../src +DEPENDPATH += $$PWD/../../src diff --git a/tool/tool.pro b/tool/tool.pro index 7c8cb4f..aeaeb47 100644 --- a/tool/tool.pro +++ b/tool/tool.pro @@ -1,28 +1,6 @@ -QT += core -QT -= gui +TEMPLATE = subdirs -CONFIG += c++11 +CONFIG += ordered -TARGET = dtk-settings-tool -CONFIG += console link_pkgconfig -CONFIG -= app_bundle - -TEMPLATE = app - -SOURCES += main.cpp - -isEmpty(PREFIX){ - PREFIX = /usr -} - -binary.files += $${OUT_PWD}/dtk-settings-tool -binary.path = $${PREFIX}/lib/dtk2 - -INSTALLS += binary - -win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../src/release/ -ldtkcore -else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../src/debug/ -ldtkcore -else:unix: LIBS += -L$$OUT_PWD/../src/ -ldtkcore - -INCLUDEPATH += $$PWD/../src -DEPENDPATH += $$PWD/../src +SUBDIRS += \ + settings \ -- 2.30.2